C# Класс Box.V2.JWTAuth.BoxJWTAuth

Box’s new authentication model allows applications to authenticate directly to Box using a JSON Web Token (JWT) signed with an RSA key. This authentication method is meant for server-to-server applications and replaces the first leg of the standard 3-legged OAuth 2.0 process in which users grant an application authorization to access their Box account.
https://docs.box.com/docs/getting-started-box-platform
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
AdminClient ( string adminToken, string asUser = null, bool suppressNotifications = null ) : BoxClient

Create admin BoxClient using an admin access token

AdminToken ( ) : string

Get admin token by posting data to auth url

BoxJWTAuth ( IBoxConfig boxConfig ) : Box.V2.Auth

Constructor for JWT authentication

Session ( string token ) : OAuthSession

Create OAuth session from token

UserClient ( string userToken, string userId ) : BoxClient

Create user BoxClient using a user access token

UserToken ( string userId ) : string

Once you have created an App User, you can request a User Access Token via the App Auth feature, which will return the OAuth 2.0 access token for the specified App User.

Приватные методы

Метод Описание
ConstructJWTAssertion ( string sub, string boxSubType ) : string
JWTAuthPost ( string assertion ) : OAuthSession

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

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

Create admin BoxClient using an admin access token
public AdminClient ( string adminToken, string asUser = null, bool suppressNotifications = null ) : BoxClient
adminToken string Admin access token
asUser string The user ID to set as the 'As-User' header parameter; used to make calls in the context of a user using an admin token
suppressNotifications bool Whether or not to suppress both email and webhook notifications. Typically used for administrative API calls. Your application must have “Manage an Enterprise” scope, and the user making the API calls is a co-admin with the correct "Edit settings for your company" permission.
Результат BoxClient

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

Get admin token by posting data to auth url
public AdminToken ( ) : string
Результат string

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

Constructor for JWT authentication
public BoxJWTAuth ( IBoxConfig boxConfig ) : Box.V2.Auth
boxConfig IBoxConfig Config contains information about client id, client secret, enterprise id, private key, private key password, public key id
Результат Box.V2.Auth

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

Create OAuth session from token
public Session ( string token ) : OAuthSession
token string Access token created by method UserToken, or AdminToken
Результат Box.V2.Auth.OAuthSession

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

Create user BoxClient using a user access token
public UserClient ( string userToken, string userId ) : BoxClient
userToken string User access token
userId string Id of the user
Результат BoxClient

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

Once you have created an App User, you can request a User Access Token via the App Auth feature, which will return the OAuth 2.0 access token for the specified App User.
public UserToken ( string userId ) : string
userId string Id of the user
Результат string