C# Класс 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
Наследование: IAuthRepository
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
_config IBoxConfig
_converter IBoxConverter
_service IBoxService

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
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

Описание методов

AuthRepository() публичный Метод

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.
Результат Box.V2.Config

AuthRepository() публичный Метод

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
Результат Box.V2.Config

AuthenticateAsync() публичный Метод

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.
Результат Task

ExchangeAuthCode() защищенный Метод

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.
Результат Task

ExchangeRefreshToken() защищенный Метод

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
Результат Task

InvalidateTokens() защищенный Метод

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
Результат Task

LogoutAsync() публичный Метод

Logs the current session out by invalidating the current Access/Refresh tokens
public LogoutAsync ( ) : Task
Результат Task

OnSessionAuthenticated() защищенный Метод

Allows sub classes to invoke the SessionAuthenticated event.
protected OnSessionAuthenticated ( OAuthSession session ) : void
session OAuthSession Authenticated session.
Результат void

OnSessionInvalidated() защищенный Метод

Allows sub classes to invoke the SessionInvalidated event
protected OnSessionInvalidated ( ) : void
Результат void

RefreshAccessTokenAsync() публичный Метод

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.
Результат Task

Описание свойств

_config защищенное свойство

protected IBoxConfig _config
Результат IBoxConfig

_converter защищенное свойство

protected IBoxConverter _converter
Результат IBoxConverter

_service защищенное свойство

protected IBoxService _service
Результат IBoxService