-
Notifications
You must be signed in to change notification settings - Fork 247
Create class GIDUserAuth #177
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /* | ||
| * Copyright 2021 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDUserAuth.h" | ||
|
|
||
| #import "GoogleSignIn/Sources/GIDUserAuth_Private.h" | ||
| #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDGoogleUser.h" | ||
|
|
||
| @implementation GIDUserAuth | ||
|
|
||
| - (instancetype)initWithGoogleUser:(GIDGoogleUser *)user | ||
| serverAuthCode:(nullable NSString *)serverAuthCode { | ||
| self = [super init]; | ||
| if (self) { | ||
| _user = user; | ||
| _serverAuthCode = serverAuthCode; | ||
| } | ||
|
|
||
| return self; | ||
| } | ||
|
|
||
| @end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * Copyright 2021 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDUserAuth.h" | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| // Private |GIDUserAuth| methods that are used in this SDK. | ||
| @interface GIDUserAuth () | ||
|
|
||
| // Private initializer for |GIDUserAuth|. | ||
| // @param user The current GIDGoogleUser. | ||
| // @param severAuthCode The one-time authorization code for backend to exchange | ||
| // access and refresh tokens. | ||
| - (instancetype)initWithGoogleUser:(GIDGoogleUser *)user | ||
| serverAuthCode:(nullable NSString *)serverAuthCode; | ||
|
|
||
| @end | ||
|
|
||
| NS_ASSUME_NONNULL_END | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| * Copyright 2021 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| @class GIDGoogleUser; | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| /// A helper object that contains the outcome of a successful signIn or addScopes flow. | ||
| @interface GIDUserAuth : NSObject | ||
|
|
||
| /// The updated `GIDGoogleUser` instance for the user who just completed the flow. | ||
| @property(nonatomic, readonly) GIDGoogleUser *user; | ||
|
|
||
| /// An OAuth2 authorization code for the home server. | ||
| @property(nonatomic, readonly, nullable) NSString *serverAuthCode; | ||
|
|
||
| /// Unsupported. | ||
| + (instancetype)new NS_UNAVAILABLE; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it worth documenting here how this type is supposed to be created?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we don't need to document that. For our clients they only need to read the data inside this class. I will add
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a public API. There is no benefit if we tell them how to create this instance because we don't want them to do it.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough. I don't think |
||
|
|
||
| /// Unsupported. | ||
| - (instancetype)init NS_UNAVAILABLE; | ||
|
|
||
| @end | ||
|
|
||
| NS_ASSUME_NONNULL_END | ||
Uh oh!
There was an error while loading. Please reload this page.