-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for custom Keychain key in Credentials Manager #208
Conversation
Auth0/CredentialsManager.swift
Outdated
@@ -40,7 +40,8 @@ public struct CredentialsManager { | |||
/// | |||
/// - Parameters: | |||
/// - authentication: Auth0 authentication instance | |||
public init(authentication: Authentication) { | |||
public init(authentication: Authentication, storeKey: String = "credentials") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add Doc Header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this in general, please add some test(s). For example using two instances and ensuring storage is isolated.
I've added two tests proving that:
I'm not best pleased with how I've laid out the tests, any feedback on this would be nice. |
Auth0/CredentialsManager.swift
Outdated
@@ -40,7 +40,9 @@ public struct CredentialsManager { | |||
/// | |||
/// - Parameters: | |||
/// - authentication: Auth0 authentication instance | |||
public init(authentication: Authentication) { | |||
/// - storeKey: String key to store user credentials in the keychain, defaults to "credentials" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to specify the type in the description String
-> Key to store...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just this to address and I'll approve, thx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, I've amended that now.
|
||
} | ||
|
||
describe("multi instances of credentials manager") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not as bothered about tests as long as they work. However, they would look cleaner to use closure shorthand like https://github.com/danielphillips/Auth0.swift/blob/a78a4018722c9202ee5d1a75c2608f5c00f855ac/Auth0Tests/CredentialsManagerSpec.swift#L263
credentialsManager.credentials {
expect($1?.accessToken) == AccessToken
expect($1?.idToken) == IdToken
done()
}
Cut down on the extra params.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point thank you. Done that now.
@danielphillips just merged another PR into master, can you rebase this please. |
d408607
to
69094ae
Compare
I'm rebased and I've addressed the feedback. |
69094ae
to
2735db4
Compare
I've addressed the doc header showing the type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Solution for support ticket 45174.
This allows us to use multiple
CredentialsManager
instances in order to support multiple accounts in one app.