Newer Version Available
TokenValidationResult Class
Namespace
Example
Here’s an example class.
1global class TokenValidationResult {
2 global TokenValidationResult(Boolean valid) { this.isValid = valid; }
3
4 global TokenValidationResult(Boolean isValid, Object data, Auth.UserData userData,
5 String token, Auth.OAuth2TokenExchangeType tokenType, String customErrorMsg) {
6
7 this.isValid = isValid;
8 this.data = data;
9 this.userData = userData;
10 this.token = token;
11 this.tokenType = tokenType;
12 this.customErrorMsg = customErrorMsg;
13
14 }
15
16 global Boolean isValid;
17 global Object data;
18 global Auth.UserData userData;
19 global String token;
20 global Auth.OAuth2TokenExchangeType tokenType; //Enum
21 global String customErrorMsg; //Custom error message that’s returned to the client if token validation fails
22
23 global Boolean isValid(){
24 return isValid;
25 }
26 global Object getData(){
27 return data;
28 }
29 global Auth.UserData getUserData(){
30 return userData;
31 }
32 global String getToken(){
33 return token;
34 }
35 global OAuth2TokenExchangeType getTokenType(){
36 return tokenType;
37 }
38 global String getCustomErrorMessage(){
39 return customErrorMsg;
40 }
41}TokenValidationResult Constructors
The following are constructors for TokenValidationResult.
TokenValidationResult(isValid, data, userData, token, tokenType, customErrorMsg)
Signature
public TokenValidationResult(Boolean isValid, Object data, Auth.UserData userData, String token, Auth.OAuth2TokenExchangeType tokenType, String customErrorMsg)
Parameters
- isValid
- Type: Boolean
- If true, the token is valid.
- data
- Type: Object
- Stores custom data that isn’t stored in userData.
- userData
- Type: Auth.UserData
- Stores information about a Salesforce user.
- token
- Type: String
- The token from the external identity provider.
- tokenType
- Type: Auth.OAuth2TokenExchangeType
- The type of token from the external identity provider.
- customErrorMsg
- Type: String
- A custom error message that’s returned if the token validation fails.
TokenValidationResult(valid)
Signature
public TokenValidationResult(Boolean valid)
Parameters
- valid
- Type: Boolean
- Indicates a valid token validation result.
TokenValidationResult Properties
The following are properties for TokenValidationResult.
customErrorMsg
Signature
public String customErrorMsg {get; set;}
Property Value
Type: String
data
Signature
public Object data {get; set;}
Property Value
Type: Object
isValid
Signature
public Boolean isValid {get; set;}
Property Value
Type: Boolean
token
Signature
public String token {get; set;}
Property Value
Type: String
tokenType
Signature
public Auth.OAuth2TokenExchangeType tokenType {get; set;}
Property Value
userData
Signature
public Auth.UserData userData {get; set;}
Property Value
Type: Auth.UserData
TokenValidationResult Methods
The following are methods for TokenValidationResult.
getCustomErrorMessage()
Signature
public String getCustomErrorMessage()
Return Value
Type: String
getData()
Signature
public Object getData()
Return Value
Type: Object
getToken()
Signature
public String getToken()
Return Value
Type: String
getTokenType()
Signature
public Auth.OAuth2TokenExchangeType getTokenType()
Return Value
getUserData()
Signature
public Auth.UserData getUserData()
Return Value
Type: Auth.UserData
isValid
Signature
public Boolean isValid {get; set;}
Property Value
Type: Boolean