Reputation: 596
In wso2 identity server how we can write custom Oauth2 token validator. As in wso2 identity server documentation there is no sample code available. And also how we can query oidc scope inside token validator for getting custom claims.
Upvotes: 0
Views: 183
Reputation: 188
According to the documentation what you are looking for is OAuth2 Token Validator
public class SO62997622 implements org.wso2.carbon.identity.oauth2.validators.OAuth2TokenValidator {
@Override
public boolean validateAccessDelegation(OAuth2TokenValidationMessageContext oatvmc) throws IdentityOAuth2Exception {
// Validate access
return false;
}
@Override
public boolean validateScope(OAuth2TokenValidationMessageContext oatvmc) throws IdentityOAuth2Exception {
// Validate scopes
return false;
}
@Override
public boolean validateAccessToken(OAuth2TokenValidationMessageContext oatvmc) throws IdentityOAuth2Exception {
// Validate the actual token
return false;
}
}
The documentation also has directions on how to enable your custom OAuth token validator and a Default implementation Class you can build upon. This is assuming Identity Server version 5.9 but should be pretty similar in previous versions.
For the second part of your question maybe Claims Retriever is what you are looking for?
Upvotes: 1