C# Class com.microsoft.dx.officewopi.Security.WopiSecurity

Class handles token generation and validation for the WOPI host
Afficher le fichier Open project: OfficeDev/PnP-WOPI Class Usage Examples

Méthodes publiques

Méthode Description
GenerateToken ( string user, string container, string docId ) : System.IdentityModel.Tokens.JwtSecurityToken

Generates an access token for the user and file

GetUserFromToken ( string tokenString ) : string

Extracts the user information from a provided access token

ValidateToken ( string tokenString, string container, string docId ) : bool

Generates an access token specific to a user and file

WriteToken ( System.IdentityModel.Tokens.JwtSecurityToken token ) : string

Converts the JwtSecurityToken to a Base64 string that can be used by the Host

Private Methods

Méthode Description
getCert ( ) : X509Certificate2

Gets the self-signed certificate used to sign the access tokens

Method Details

GenerateToken() public méthode

Generates an access token for the user and file
public GenerateToken ( string user, string container, string docId ) : System.IdentityModel.Tokens.JwtSecurityToken
user string
container string
docId string
Résultat System.IdentityModel.Tokens.JwtSecurityToken

GetUserFromToken() public static méthode

Extracts the user information from a provided access token
public static GetUserFromToken ( string tokenString ) : string
tokenString string
Résultat string

ValidateToken() public static méthode

Generates an access token specific to a user and file
public static ValidateToken ( string tokenString, string container, string docId ) : bool
tokenString string
container string
docId string
Résultat bool

WriteToken() public méthode

Converts the JwtSecurityToken to a Base64 string that can be used by the Host
public WriteToken ( System.IdentityModel.Tokens.JwtSecurityToken token ) : string
token System.IdentityModel.Tokens.JwtSecurityToken
Résultat string