Skip to content

Commit

Permalink
Merge master into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
p2 committed Nov 24, 2016
2 parents 068cf29 + aaa6cb2 commit 316587c
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 31 deletions.
24 changes: 13 additions & 11 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ Contributors

Contributors to the codebase, in reverse chronological order:

Vladislav Prusakov, @SpectralDragon
Andrew Schenk, @andrewschenk
Thomas Einwaller, @tompson
David Kraus, @davidkraus
Daniel Dengler, @ddengler
Tyler Swartz, @tylerswartz
Guilherme Rambo, @insidegui
Glenn Schmidt, @glennschmidt
Tomohiro Kumagai, @ez-net
Tim Sneed, @trsneed
Vojto Rinik, @vojto
- David Everlöf, @everlof
- @aidzz
- Vladislav Prusakov, @SpectralDragon
- Andrew Schenk, @andrewschenk
- Thomas Einwaller, @tompson
- David Kraus, @davidkraus
- Daniel Dengler, @ddengler
- Tyler Swartz, @tylerswartz
- Guilherme Rambo, @insidegui
- Glenn Schmidt, @glennschmidt
- Tomohiro Kumagai, @ez-net
- Tim Sneed, @trsneed
- Vojto Rinik, @vojto
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,16 @@ If you're unfamiliar with CocoaPods, read [using CocoaPods](http://guides.cocoap
platform :ios, '8.0' # or platform :osx, '10.9'
use_frameworks!
target `YourApp` do
#pod 'p2.OAuth2', '~> 3.0' # NOT YET AVAILABLE
pod 'p2.OAuth2', :git => 'https://github.com/p2/OAuth2', :submodules => true
pod 'p2.OAuth2', '~> 3.0'
end
```

If you want the bleeding edge, use this command for CocoaPods instead – note the `submodules` flag: without it the library will not compile.

```ruby
pod 'p2.OAuth2', :git => 'https://github.com/p2/OAuth2', :submodules => true
```


License
-------
Expand Down
5 changes: 4 additions & 1 deletion Sources/Base/OAuth2Base.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,13 @@ open class OAuth2Base: OAuth2Securable {
- keychain (Bool, true by default, applies to using the system keychain)
- keychain_access_mode (String, value for keychain kSecAttrAccessible attribute, kSecAttrAccessibleWhenUnlocked by default)
- keychain_access_group (String, value for keychain kSecAttrAccessGroup attribute, nil by default)
- verbose (Bool, false by default, applies to client logging)
- keychain_account_for_client_credentials(String, "clientCredentials" by default)
- keychain_account_for_tokens(String, "currentTokens" by default)
- secret_in_body (Bool, false by default, forces the flow to use the request body for the client secret)
- parameters ([String: String], custom request parameters to be added during authorization)
- token_assume_unexpired (Bool, true by default, whether to use access tokens that do not come with an "expires_in" parameter)

- verbose (Bool, false by default, applies to client logging)
*/
override public init(settings: OAuth2JSON) {
clientConfig = OAuth2ClientConfig(settings: settings)
Expand Down
8 changes: 7 additions & 1 deletion Sources/Base/OAuth2Securable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,18 @@ open class OAuth2Securable: OAuth2Requestable {
/**
Base initializer.

Looks at the `verbose`, `keychain`, `keychain_access_mode` and `keychain_access_group`. Everything else is handled by subclasses.
Looks at the `verbose`, `keychain`, `keychain_access_mode`, `keychain_access_group` `keychain_account_for_client_credentials` and `keychain_account_for_tokens`. Everything else is handled by subclasses.
*/
public init(settings: OAuth2JSON) {
self.settings = settings

// keychain settings
if let accountForClientCredentials = settings["keychain_account_for_client_credentials"] as? String {
keychainAccountForClientCredentials = accountForClientCredentials
}
if let accountForTokens = settings["keychain_account_for_tokens"] as? String {
keychainAccountForTokens = accountForTokens
}
if let keychain = settings["keychain"] as? Bool {
useKeychain = keychain
}
Expand Down
36 changes: 20 additions & 16 deletions Sources/Flows/OAuth2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,27 @@ open class OAuth2: OAuth2Base {

The following settings keys are currently supported:

- client_id (string)
- client_secret (string), usually only needed for code grant
- authorize_uri (URL-string)
- token_uri (URL-string), if omitted the authorize_uri will be used to obtain tokens
- redirect_uris (list of URL-strings)
- scope (string)

- client_name (string)
- registration_uri (URL-string)
- logo_uri (URL-string)

- keychain (bool, true by default, applies to using the system keychain)
- keychain_access_mode (string, value for keychain kSecAttrAccessible attribute, kSecAttrAccessibleWhenUnlocked by default)
- keychain_access_group (string, value for keychain kSecAttrAccessGroup attribute, nil by default)
- client_id (String)
- client_secret (String), usually only needed for code grant
- authorize_uri (URL-String)
- token_uri (URL-String), if omitted the authorize_uri will be used to obtain tokens
- redirect_uris (Array of URL-Strings)
- scope (String)

- client_name (String)
- registration_uri (URL-String)
- logo_uri (URL-String)

- keychain (Bool, true by default, applies to using the system keychain)
- keychain_access_mode (String, value for keychain kSecAttrAccessible attribute, kSecAttrAccessibleWhenUnlocked by default)
- keychain_access_group (String, value for keychain kSecAttrAccessGroup attribute, nil by default)
- keychain_account_for_client_credentials(String, "clientCredentials" by default)
- keychain_account_for_tokens(String, "currentTokens" by default)
- secret_in_body (Bool, false by default, forces the flow to use the request body for the client secret)
- parameters ([String: String], custom request parameters to be added during authorization)
- token_assume_unexpired (Bool, true by default, whether to use access tokens that do not come with an "expires_in" parameter)

- verbose (bool, false by default, applies to client logging)
- secret_in_body (bool, false by default, forces the flow to use the request body for the client secret)
- token_assume_unexpired (bool, true by default, whether to use access tokens that do not come with an "expires_in" parameter)
*/
override public init(settings: OAuth2JSON) {
super.init(settings: settings)
Expand Down

0 comments on commit 316587c

Please sign in to comment.