A convenience class that retains the auth state between OIDAuthorizationResponses
and OIDTokenResponses
.
More...
#import <OIDAuthState.h>
Inherits NSObject, and <NSSecureCoding>.
|
(instancetype) | - NS_UNAVAILABLE |
|
(instancetype) | - initWithAuthorizationResponse: |
| Creates an auth state from an authorization response. More...
|
|
(instancetype) | - initWithAuthorizationResponse:tokenResponse: |
| Creates an auth state from an authorization and token response. More...
|
|
(instancetype) | - initWithRegistrationResponse: |
| Creates an auth state from an registration response. More...
|
|
(instancetype) | - initWithAuthorizationResponse:tokenResponse:registrationResponse: |
| Creates an auth state from an authorization, token and registration response. More...
|
|
(void) | - updateWithAuthorizationResponse:error: |
| Updates the authorization state based on a new authorization response. More...
|
|
(void) | - updateWithTokenResponse:error: |
| Updates the authorization state based on a new token response. More...
|
|
(void) | - updateWithRegistrationResponse: |
| Updates the authorization state based on a new registration response. More...
|
|
(void) | - updateWithAuthorizationError: |
| Updates the authorization state based on an authorization error. More...
|
|
(void) | - performActionWithFreshTokens: |
| Calls the block with a valid access token (refreshing it first, if needed), or if a refresh was needed and failed, with the error that caused it to fail. More...
|
|
(void) | - performActionWithFreshTokens:additionalRefreshParameters: |
| Calls the block with a valid access token (refreshing it first, if needed), or if a refresh was needed and failed, with the error that caused it to fail. More...
|
|
(void) | - setNeedsTokenRefresh |
| Forces a token refresh the next time performActionWithFreshTokens: is called, even if the current tokens are considered valid.
|
|
(nullable OIDTokenRequest *) | - tokenRefreshRequest |
| Creates a token request suitable for refreshing an access token. More...
|
|
(nullable OIDTokenRequest *) | - tokenRefreshRequestWithAdditionalParameters: |
| Creates a token request suitable for refreshing an access token. More...
|
|
(void) | - withFreshTokensPerformAction: |
| Deprecated, use performActionWithFreshTokens: . Calls the block with a valid access token (refreshing it first, if needed), or if a refresh was needed and failed, with the error that caused it to fail. More...
|
|
A convenience class that retains the auth state between OIDAuthorizationResponses
and OIDTokenResponses
.
◆ authStateByPresentingAuthorizationRequest:presentingViewController:callback:()
Convenience method to create a OIDAuthState
by presenting an authorization request and performing the authorization code exchange in the case of code flow requests.
- Parameters
-
authorizationRequest | The authorization request to present. |
presentingViewController | The view controller from which to present the SFSafariViewController . |
callback | The method called when the request has completed or failed. |
- Returns
- A
OIDAuthorizationFlowSession
instance which will terminate when it receives a OIDAuthorizationFlowSession.cancel
message, or after processing a OIDAuthorizationFlowSession.resumeAuthorizationFlowWithURL:
message.
Provided by category OIDAuthState(IOS).
◆ authStateByPresentingAuthorizationRequest:UICoordinator:callback:()
Convenience method to create a OIDAuthState
by presenting an authorization request and performing the authorization code exchange in the case of code flow requests.
- Parameters
-
authorizationRequest | The authorization request to present. |
UICoordinator | Generic authorization UI coordinator that can present an authorization request. |
callback | The method called when the request has completed or failed. |
- Returns
- A
OIDAuthorizationFlowSession
instance which will terminate when it receives a OIDAuthorizationFlowSession.cancel
message, or after processing a OIDAuthorizationFlowSession.resumeAuthorizationFlowWithURL:
message.
◆ initWithAuthorizationResponse:()
Creates an auth state from an authorization response.
- Parameters
-
authorizationResponse | The authorization response. |
◆ initWithAuthorizationResponse:tokenResponse:()
Creates an auth state from an authorization and token response.
- Parameters
-
authorizationResponse | The authorization response. |
tokenResponse | The token response. |
◆ initWithAuthorizationResponse:tokenResponse:registrationResponse:()
Creates an auth state from an authorization, token and registration response.
- Parameters
-
authorizationResponse | The authorization response. |
tokenResponse | The token response. |
registrationResponse | The registration response. |
◆ initWithRegistrationResponse:()
Creates an auth state from an registration response.
- Parameters
-
registrationResponse | The registration response. |
◆ performActionWithFreshTokens:()
Calls the block with a valid access token (refreshing it first, if needed), or if a refresh was needed and failed, with the error that caused it to fail.
- Parameters
-
action | The block to execute with a fresh token. This block will be executed on the main thread. |
◆ performActionWithFreshTokens:additionalRefreshParameters:()
Calls the block with a valid access token (refreshing it first, if needed), or if a refresh was needed and failed, with the error that caused it to fail.
- Parameters
-
action | The block to execute with a fresh token. This block will be executed on the main thread. |
additionalParameters | Additional parameters for the token request if token is refreshed. |
◆ tokenRefreshRequest()
◆ tokenRefreshRequestWithAdditionalParameters:()
- (nullable OIDTokenRequest *) tokenRefreshRequestWithAdditionalParameters: |
|
(nullable NSDictionary< NSString *, NSString * > *) |
additionalParameters |
|
◆ updateWithAuthorizationError:()
- (void) updateWithAuthorizationError: |
|
(NSError *) |
authorizationError |
|
Updates the authorization state based on an authorization error.
- Parameters
-
authorizationError | The authorization error. Call this method if you receive an authorization error during an API call to invalidate the authentication state of this OIDAuthState . Don't call with errors unrelated to authorization, such as transient network errors. The OIDAuthStateErrorDelegate.authState:didEncounterAuthorizationError: method of errorDelegate will be called with the error. You may optionally use the convenience method resourceServerAuthorizationErrorWithCode:errorResponse:underlyingError: (OIDErrorUtilities) to create objects for use here. The latest error received is stored in authorizationError . Note: that after unarchiving this object, the property of this error will be nil. |
◆ updateWithAuthorizationResponse:error:()
- (void) updateWithAuthorizationResponse: |
|
(nullable OIDAuthorizationResponse *) |
authorizationResponse |
error: |
|
(nullable NSError *) |
error |
|
|
| |
Updates the authorization state based on a new authorization response.
- Parameters
-
authorizationResponse | The new authorization response to update the state with. |
error | Any error encountered when performing the authorization request. Errors in the domain OIDOAuthAuthorizationErrorDomain are reflected in the auth state, other errors are assumed to be transient, and ignored. Typically called with the response from an incremental authorization request, or if using the implicit flow. Will clear the lastTokenResponse property. |
◆ updateWithRegistrationResponse:()
Updates the authorization state based on a new registration response.
- Parameters
-
registrationResponse | The new registration response to update the state with. Typically called with the response from a successful client registration request. Will reset the auth state. |
◆ updateWithTokenResponse:error:()
- (void) updateWithTokenResponse: |
|
(nullable OIDTokenResponse *) |
tokenResponse |
error: |
|
(nullable NSError *) |
error |
|
|
| |
Updates the authorization state based on a new token response.
- Parameters
-
tokenResponse | The new token response to update the state from. |
error | Any error encountered when performing the authorization request. Errors in the domain OIDOAuthTokenErrorDomain are reflected in the auth state, other errors are assumed to be transient, and ignored. Typically called with the response from an authorization code exchange, or a token refresh. |
◆ withFreshTokensPerformAction:()
Deprecated, use performActionWithFreshTokens:
. Calls the block with a valid access token (refreshing it first, if needed), or if a refresh was needed and failed, with the error that caused it to fail.
- Parameters
-
action | The block to execute with a fresh token. This block will be executed on the main thread. |
- Deprecated:
- Use
performActionWithFreshTokens:
which is equivalent.
◆ refreshToken
- (NSString*) refreshToken |
|
readnonatomicassign |
◆ scope
The scope of the current authorization grant. This represents the latest scope returned by the server and may be a subset of the scope that was initially granted.
The documentation for this class was generated from the following file:
- /Users/atmahajan/MobileAccess-SDK/ios/sdk/MFAuthLib/AppAuth.framework/Headers/OIDAuthState.h