在 iOS 中使用 LDAP 进行身份验证

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7877233/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 22:01:41  来源:igfitidea点击:

Using LDAP for authentication in iOS

iosauthenticationactive-directoryldap

提问by ios85

I have been looking for a tutorial on using LDAP on an iOS device is this possible? I havent seen any articles or tutorials on it. Is there another way I should be going about doing authentication against my Active Directory? Can anyone point me in the right direction?

我一直在寻找有关在 iOS 设备上使用 LDAP 的教程,这可能吗?我还没有看到任何关于它的文章或教程。是否有另一种方法可以对我的 Active Directory 进行身份验证?任何人都可以指出我正确的方向吗?

采纳答案by Michael Dautermann

I was able to Google up a few answers for you.

我能够为你谷歌搜索一些答案。

Integrating LDAP into an iPhone application

将 LDAP 集成到 iPhone 应用程序中

LDAP and the iPhone

LDAP 和 iPhone

And LDAP is even supported within Apple libraries & code, like the iOS configuration profile.

Apple 库和代码中甚至支持 LDAP,例如iOS 配置文件

回答by David M. Syzdek

I have a port of OpenLDAP with Cyrus-SASL and OpenSSL in my iOS Ports project: https://github.com/bindle/iOSPorts

我的 iOS Ports 项目中有一个带有 Cyrus-SASL 和 OpenSSL 的 OpenLDAP 端口:https: //github.com/bindle/iOSPorts

If using Xcode 4.3 or later, please verify that the Xcode commandline tools are installed before using the following instructions.

如果使用 Xcode 4.3 或更高版本,请在使用以下说明之前验证是否安装了 Xcode 命令行工具。

To include LDAP support:

要包括 LDAP 支持:

  1. Clone the project: git clone git://github.com/bindle/iOSPorts.git
  2. Add the project file iOSPorts/ports/database/openldap/openldap.xcodeprojto your Xcode project.
  3. Navigate to the "Build Phases" tab for your build target.
  4. In "Target Dependencies", add "ldap (openldap)". This will cause the required source code to be downloaded and compiled when you build your target.
  5. In "Link Binary With Libraries", add the following libraries:
    • libresolv.dylib
    • libssl.a
    • libcrypto.a
    • liblber.a
    • libldap.a
    • libsasl2.a
  6. Under the "Build Settings", add "/iOSPorts/include" to the "User Header Search Paths".
  1. 克隆项目:git clone git://github.com/bindle/iOSPorts.git
  2. 将项目文件添加iOSPorts/ports/database/openldap/openldap.xcodeproj到您的 Xcode 项目中。
  3. 导航到构建目标的“构建阶段”选项卡。
  4. 在“目标依赖项”中,添加“ldap (openldap)”。这将导致在构建目标时下载和编译所需的源代码。
  5. 在“Link Binary With Libraries”中,添加以下库:
    • libresolv.dylib
    • libssl.a
    • libcrypto.a
    • liblber.a
    • libldap.a
    • libsasl2.a
  6. 在“Build Settings”下,将“/iOSPorts/include”添加到“User Header Search Paths”。

The OpenLDAP client libraries should now be available from within your project. I have an example project for iOS in examples/database/openldap/ldapsearch (the example returns the search results using NSLog()).

OpenLDAP 客户端库现在应该可以从您的项目中使用。我在 examples/database/openldap/ldapsearch 中有一个 iOS 示例项目(该示例使用 NSLog() 返回搜索结果)。