-
Notifications
You must be signed in to change notification settings - Fork 200
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
feat(Auth): Implementation of getCurrentUser api #455
Conversation
@@ -16,13 +16,14 @@ class AuthenticationProviderAdapter: AuthenticationProviderBehavior { | |||
self.awsMobileClient = awsMobileClient | |||
} | |||
|
|||
func signInUsername() -> Result<String, AuthError> { | |||
func currentUser() -> AuthUser? { |
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.
rename to getCurrentUser
, or make this a property.
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.
Updated
/// Value maps to the username of a user in AWS Cognito User Pool. This value is set by AWS Cognito and not by the | ||
/// user and does not always map with the username used to signIn. |
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.
As noted offline, we need to figure out this behavior.
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.
Keeping this for now as discussed
cbb4aff
to
c7bd293
Compare
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.
Approved w/comments, but in general, we need to pay better attention to our naming, even internally. If a method is returning a value, name it 'get' (for retrievals) or 'make' (for creation). If a value can be reasonably modeled as a property (synchronous, no throwing conditions, no parameters required), favor properties rather than getter methods.
@@ -107,6 +107,10 @@ class AWSMobileClientAdapter: AWSMobileClientBehavior { | |||
return awsMobileClient.username | |||
} | |||
|
|||
func userSub() -> String? { |
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.
Make this getUserSub()
or a property
@@ -52,6 +52,8 @@ protocol AWSMobileClientBehavior { | |||
|
|||
func username() -> String? | |||
|
|||
func userSub() -> String? |
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.
make this getUserSub()
or a userSub
property.
@@ -52,6 +52,8 @@ protocol AWSMobileClientBehavior { | |||
|
|||
func username() -> String? |
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.
Make this getUsername()
or a username
property
be2d637
to
1a50870
Compare
1a50870
to
6e09cc4
Compare
Description of changes:
This PR is dependent on userSub api in AWSMobileClient - aws-amplify/aws-sdk-ios#2599
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.