public abstract class AbstractOAuth2Authenticator extends Object implements IAuthenticator
| Modifier and Type | Field and Description |
|---|---|
static String |
CLIENT_ID_KEY
The config storage key for the facebook client id.
|
static String |
CLIENT_SECRET_KEY
The config storage key for the facebook client secret.
|
static javax.ws.rs.core.GenericType<HashMap<String,String>> |
MAP_TYPE
Map reference, used for decoding.
|
| Constructor and Description |
|---|
AbstractOAuth2Authenticator() |
| Modifier and Type | Method and Description |
|---|---|
UserIdentity |
authenticate(Authenticator authenticator,
javax.ws.rs.core.MultivaluedMap<String,String> parameters,
URI callback)
Handle the response from the IdP.
|
javax.ws.rs.core.Response |
delegate(Authenticator authenticator,
URI callback)
Delegate an authentication request to the oauth2 IdP.
|
protected abstract String |
getAuthEndpoint()
The path to the /authorization endpoint.
|
javax.ws.rs.client.Client |
getClient()
Get the HTTP client.
|
protected String |
getClientId(Authenticator authenticator)
Provided with an authenticator, provide the client id.
|
protected String |
getClientSecret(Authenticator authenticator)
Provided with an authenticator, extract the client secret.
|
protected abstract String |
getScopes()
The string listing out all the scopes required.
|
org.hibernate.Session |
getSession()
Get the session.
|
protected abstract String |
getTokenEndpoint()
The path to the /token endpoint.
|
protected abstract OAuth2User |
loadUserIdentity(OAuth2IdPToken token)
Provided a (presumably valid) OAuth2 token, retrieve the user's remote
identity from the IdP.
|
void |
setClient(javax.ws.rs.client.Client client)
Set the HTTP client.
|
void |
setSession(org.hibernate.Session session)
Set the hibernate session.
|
void |
validate(Authenticator authenticator)
Validate that the configuration values provided are correct.
|
public static final javax.ws.rs.core.GenericType<HashMap<String,String>> MAP_TYPE
public static final String CLIENT_ID_KEY
public static final String CLIENT_SECRET_KEY
public final javax.ws.rs.client.Client getClient()
public final void setClient(javax.ws.rs.client.Client client)
client - The HTTP client.public final org.hibernate.Session getSession()
public final void setSession(org.hibernate.Session session)
session - The new hibernate session.protected abstract String getAuthEndpoint()
protected abstract String getTokenEndpoint()
protected abstract String getScopes()
protected final String getClientSecret(Authenticator authenticator)
authenticator - The authenticator.protected final String getClientId(Authenticator authenticator)
authenticator - The authenticator.public final javax.ws.rs.core.Response delegate(Authenticator authenticator, URI callback)
delegate in interface IAuthenticatorauthenticator - The authenticator configuration.callback - The redirect, on this server, where the response
should go.public final void validate(Authenticator authenticator) throws KangarooException
validate in interface IAuthenticatorauthenticator - The authenticator configuration.KangarooException - Thrown if we cannot use these values.public final UserIdentity authenticate(Authenticator authenticator, javax.ws.rs.core.MultivaluedMap<String,String> parameters, URI callback)
authenticate in interface IAuthenticatorauthenticator - The authenticator configuration.parameters - Parameters for the authenticator, retrieved from
an appropriate source.callback - The redirect, on this server, where the response
should go.protected abstract OAuth2User loadUserIdentity(OAuth2IdPToken token)
token - The OAuth token.Copyright © 2018 krotscheck.net. All rights reserved.