org.jboss.resteasy.examples.oauth.authenticator
Class OAuthBasicAuthenticator
java.lang.Object
org.apache.catalina.valves.ValveBase
org.apache.catalina.authenticator.AuthenticatorBase
org.jboss.resteasy.examples.oauth.authenticator.OAuthBasicAuthenticator
- All Implemented Interfaces:
- MBeanRegistration, org.apache.catalina.Authenticator, org.apache.catalina.Contained, org.apache.catalina.Lifecycle, org.apache.catalina.Valve
public class OAuthBasicAuthenticator
- extends org.apache.catalina.authenticator.AuthenticatorBase
|
Field Summary |
protected String |
driver
These DB connection properties are not used at the moment as a DB-aware
OAuthProvider expects db.properties be available on the class path;
However, an OAuthProvider constructor accepting either Properties or Map
can be used when instantiating the provider and have these properties injected. |
protected String |
password
|
protected String |
url
|
protected String |
user
|
| Fields inherited from class org.apache.catalina.authenticator.AuthenticatorBase |
algorithm, cache, changeSessionIdOnAuthentication, context, DEFAULT_ALGORITHM, digest, disableProxyCaching, entropy, info, lifecycle, random, randomClass, securePagesWithPragma, SESSION_ID_BYTES, sm, sso, started |
| Fields inherited from class org.apache.catalina.valves.ValveBase |
container, containerLog, controller, domain, mserver, next, oname |
| Fields inherited from interface org.apache.catalina.Lifecycle |
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT |
| Methods inherited from class org.apache.catalina.authenticator.AuthenticatorBase |
addLifecycleListener, associate, authenticate, findLifecycleListeners, generateSessionId, getAlgorithm, getCache, getContainer, getDigest, getDisableProxyCaching, getEntropy, getRandom, getRandomClass, getSecurePagesWithPragma, invoke, isChangeSessionIdOnAuthentication, login, logout, reauthenticateFromSSO, register, removeLifecycleListener, setAlgorithm, setCache, setChangeSessionIdOnAuthentication, setDisableProxyCaching, setEntropy, setRandomClass, setSecurePagesWithPragma, stop, unregister |
| Methods inherited from class org.apache.catalina.valves.ValveBase |
backgroundProcess, createObjectName, event, getContainerName, getController, getDomain, getNext, getObjectName, getParentName, postDeregister, postRegister, preDeregister, preRegister, setController, setNext, setObjectName, toString |
driver
protected String driver
- These DB connection properties are not used at the moment as a DB-aware
OAuthProvider expects db.properties be available on the class path;
However, an OAuthProvider constructor accepting either Properties or Map
can be used when instantiating the provider and have these properties injected.
This option can work given that it is easy to inject the configuration properties
into this Authenticator implementation but it is tricky to do for OAuthProvider
unless it is converted into a Catalina Realm which makes it all very complicated
when we have Basic and OAuth - given that Basic and OAuth realms
(i.e, databases of users and their passwords, etc) are unlikely to intersect or work
in the "or" combination.
url
protected String url
user
protected String user
password
protected String password
OAuthBasicAuthenticator
public OAuthBasicAuthenticator()
getInfo
public String getInfo()
- Specified by:
getInfo in interface org.apache.catalina.Valve- Overrides:
getInfo in class org.apache.catalina.authenticator.AuthenticatorBase
setDriver
public void setDriver(String driver)
getDriver
public String getDriver()
setUrl
public void setUrl(String url)
getUrl
public String getUrl()
setUser
public void setUser(String user)
getUser
public String getUser()
setPassword
public void setPassword(String password)
getPassword
public String getPassword()
setOauthProviderName
public void setOauthProviderName(String oauthProviderName)
getOauthProviderName
public String getOauthProviderName()
setContainer
public void setContainer(org.apache.catalina.Container container)
- Specified by:
setContainer in interface org.apache.catalina.Contained- Overrides:
setContainer in class org.apache.catalina.authenticator.AuthenticatorBase
authenticate
protected boolean authenticate(org.apache.catalina.connector.Request request,
javax.servlet.http.HttpServletResponse response,
org.apache.catalina.deploy.LoginConfig config)
throws IOException
- Specified by:
authenticate in class org.apache.catalina.authenticator.AuthenticatorBase
- Throws:
IOException
start
public void start()
throws org.apache.catalina.LifecycleException
- Specified by:
start in interface org.apache.catalina.Lifecycle- Overrides:
start in class org.apache.catalina.authenticator.AuthenticatorBase
- Throws:
org.apache.catalina.LifecycleException
doAuthenticateOAuth
protected void doAuthenticateOAuth(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws IOException,
javax.servlet.ServletException
- Throws:
IOException
javax.servlet.ServletException
createPrincipalAndRoles
protected void createPrincipalAndRoles(javax.servlet.http.HttpServletRequest request,
OAuthConsumer consumer,
OAuthToken accessToken)
Copyright © 2011. All Rights Reserved.