C# Class Box.V2.Auth.AuthRepository

Default auth repository implementation that will manage the life cycle of the authentication tokens. This class can be extended to provide your own token management implementation by overriding the virtual methods
Inheritance: IAuthRepository
Afficher le fichier Open project: box/box-windows-sdk-v2 Class Usage Examples

Protected Properties

Свойство Type Description
_config IBoxConfig
_converter IBoxConverter
_service IBoxService

Méthodes publiques

Méthode Description
AuthRepository ( IBoxConfig boxConfig, IBoxService boxService, IBoxConverter converter ) : Box.V2.Config

Instantiates a new AuthRepository.

AuthRepository ( IBoxConfig boxConfig, IBoxService boxService, IBoxConverter converter, OAuthSession session ) : Box.V2.Config

Instantiates a new AuthRepository

AuthenticateAsync ( string authCode ) : Task

Authenticates the session by exchanging the provided auth code for a Access/Refresh token pair

LogoutAsync ( ) : Task

Logs the current session out by invalidating the current Access/Refresh tokens

RefreshAccessTokenAsync ( string accessToken ) : Task

Refreshes the session by exchanging the access token for a new Access/Refresh token pair. In general, this method should not need to be called explicitly, as an automatic refresh is invoked when the SDK detects that the tokens have expired.

Méthodes protégées

Méthode Description
ExchangeAuthCode ( string authCode ) : Task

Performs the authentication request using the provided auth code

ExchangeRefreshToken ( string refreshToken ) : Task

Performs the refresh request using the provided refresh token

InvalidateTokens ( string accessToken ) : Task

Performs the revoke request using the provided access token. This will invalidate both the access and refresh tokens

OnSessionAuthenticated ( OAuthSession session ) : void

Allows sub classes to invoke the SessionAuthenticated event.

OnSessionInvalidated ( ) : void

Allows sub classes to invoke the SessionInvalidated event

Method Details

AuthRepository() public méthode

Instantiates a new AuthRepository.
public AuthRepository ( IBoxConfig boxConfig, IBoxService boxService, IBoxConverter converter ) : Box.V2.Config
boxConfig IBoxConfig The Box configuration that should be used.
boxService IBoxService The Box service that will be used to make the requests.
converter IBoxConverter How requests/responses will be serialized/deserialized respectively.
Résultat Box.V2.Config

AuthRepository() public méthode

Instantiates a new AuthRepository
public AuthRepository ( IBoxConfig boxConfig, IBoxService boxService, IBoxConverter converter, OAuthSession session ) : Box.V2.Config
boxConfig IBoxConfig The Box configuration that should be used
boxService IBoxService The Box service that will be used to make the requests
converter IBoxConverter How requests/responses will be serialized/deserialized respectively
session OAuthSession The current authenticated session
Résultat Box.V2.Config

AuthenticateAsync() public méthode

Authenticates the session by exchanging the provided auth code for a Access/Refresh token pair
public AuthenticateAsync ( string authCode ) : Task
authCode string Authorization Code. The authorization code is only valid for 30 seconds.
Résultat Task

ExchangeAuthCode() protected méthode

Performs the authentication request using the provided auth code
protected ExchangeAuthCode ( string authCode ) : Task
authCode string Authorization Code. The authorization code is only valid for 30 seconds.
Résultat Task

ExchangeRefreshToken() protected méthode

Performs the refresh request using the provided refresh token
protected ExchangeRefreshToken ( string refreshToken ) : Task
refreshToken string Refresh token used to exchange for a new access token. Each refresh_token is valid for one use in 60 days. Every time you get a new access_token by using a refresh_token, we reset your timer for the 60 day period and hand you a new refresh_token
Résultat Task

InvalidateTokens() protected méthode

Performs the revoke request using the provided access token. This will invalidate both the access and refresh tokens
protected InvalidateTokens ( string accessToken ) : Task
accessToken string The access token to invalidate
Résultat Task

LogoutAsync() public méthode

Logs the current session out by invalidating the current Access/Refresh tokens
public LogoutAsync ( ) : Task
Résultat Task

OnSessionAuthenticated() protected méthode

Allows sub classes to invoke the SessionAuthenticated event.
protected OnSessionAuthenticated ( OAuthSession session ) : void
session OAuthSession Authenticated session.
Résultat void

OnSessionInvalidated() protected méthode

Allows sub classes to invoke the SessionInvalidated event
protected OnSessionInvalidated ( ) : void
Résultat void

RefreshAccessTokenAsync() public méthode

Refreshes the session by exchanging the access token for a new Access/Refresh token pair. In general, this method should not need to be called explicitly, as an automatic refresh is invoked when the SDK detects that the tokens have expired.
public RefreshAccessTokenAsync ( string accessToken ) : Task
accessToken string The access token to refresh.
Résultat Task

Property Details

_config protected_oe property

protected IBoxConfig _config
Résultat IBoxConfig

_converter protected_oe property

protected IBoxConverter _converter
Résultat IBoxConverter

_service protected_oe property

protected IBoxService _service
Résultat IBoxService