项目作者: aerogear

项目描述 :
Client library for OAuth2/OpenID Connect
高级语言: Swift
项目地址: git://github.com/aerogear/aerogear-ios-oauth2.git
创建时间: 2014-09-09T13:05:32Z
项目社区:https://github.com/aerogear/aerogear-ios-oauth2

开源协议:Apache License 2.0

下载


aerogear-ios-oauth2

Maintenance
circle-ci
License
GitHub release
CocoaPods
Platform

OAuth2 Client based on aerogear-ios-http.

Project Info
License: Apache License, Version 2.0
Build: CocoaPods
Languague: Swift 4
Documentation: http://aerogear.org/ios/
Issue tracker: https://issues.jboss.org/browse/AGIOS
Mailing lists: aerogear-users (subscribe)
aerogear-dev (subscribe)

Table of Content

Features

  • Account manager for multiple OAuth2 accounts,
  • Request access and refresh token,
  • Grant access through secure external browser and URI schema to re-enter app,
  • (implicit or explicit) refresh tokens,
  • Revoke tokens,
  • Permanent secure storage,
  • Adaptable to OAuth2 specific providers. Existing extensions: Google, Facebook, Keycloak
  • OpenID Connect login

Installation

CocoaPods

In your Podfile add:

  1. pod 'AeroGearOAuth2'

and then:

  1. pod install

to install your dependencies

Usage

Grant for GET with a predefined config like Facebook

  1. let facebookConfig = FacebookConfig(
  2. clientId: "YYY",
  3. clientSecret: "XXX",
  4. scopes:["photo_upload, publish_actions"]
  5. )
  6. let oauth2Module = AccountManager.addFacebookAccount(config: facebookConfig)
  7. let http = Http()
  8. http.authzModule = oauth2Module
  9. http.request(method: .get, path: "/get", completionHandler: {(response, error) in
  10. // handle response
  11. })

OpenID Connect with Keycloak

  1. let keycloakConfig = KeycloakConfig(
  2. clientId: "sharedshoot-third-party",
  3. host: "http://localhost:8080",
  4. realm: "shoot-realm",
  5. isOpenIDConnect: true
  6. )
  7. let oauth2Module = AccountManager.addKeycloakAccount(config: keycloakConfig)
  8. let http = Http()
  9. http.authzModule = oauth2Module
  10. oauth2Module.login {(accessToken: AnyObject?, claims: OpenIdClaim?, error: NSError?) in // [1]
  11. // Do your own stuff here
  12. }

Documentation

For more details about that please consult our documentation.

Demo apps

Take a look in our demo apps:

Development

If you would like to help develop AeroGear you can join our developer’s mailing list, join #aerogear on Freenode, or shout at us on Twitter @aerogears.

Also takes some time and skim the contributor guide

Questions?

Join our user mailing list for any questions or help! We really hope you enjoy app development with AeroGear!

Found a bug?

If you found a bug please create a ticket for us on Jira with some steps to reproduce it.