Search in sources :

Example 1 with ICustomGrantTypeHandler

use of com.apifest.oauth20.api.ICustomGrantTypeHandler in project xian by happyyangyuan.

the class Authenticator method callCustomGrantTypeHandler.

protected UserDetails callCustomGrantTypeHandler(HttpRequest authRequest) throws AuthenticationException {
    UserDetails userDetails = null;
    ICustomGrantTypeHandler customHandler;
    if (OAuthConfig.getCustomGrantTypeHandler() != null) {
        try {
            customHandler = OAuthConfig.getCustomGrantTypeHandler().newInstance();
            userDetails = customHandler.execute(authRequest);
        } catch (InstantiationException | IllegalAccessException e) {
            LOG.error("cannot instantiate custom grant_type class", e);
            throw new AuthenticationException(e.getMessage());
        }
    }
    return userDetails;
}
Also used : UserDetails(com.apifest.oauth20.api.UserDetails) AuthenticationException(com.apifest.oauth20.api.AuthenticationException) ICustomGrantTypeHandler(com.apifest.oauth20.api.ICustomGrantTypeHandler)

Aggregations

AuthenticationException (com.apifest.oauth20.api.AuthenticationException)1 ICustomGrantTypeHandler (com.apifest.oauth20.api.ICustomGrantTypeHandler)1 UserDetails (com.apifest.oauth20.api.UserDetails)1