|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.confluence.rpc.auth.TokenAuthenticationInvocationHandler
public class TokenAuthenticationInvocationHandler
An interceptor to handle token based authentication and login/logout.
For login and logout method calls on the target object, invokesTokenAuthenticationManager.login(String, String)
or
TokenAuthenticationManager.logout(String)
instead.
For all other methods, uses the first argument as a token to look up an authenticated user in the
TokenAuthenticationManager
and set the AuthenticatedUserThreadLocal
before
executing the method.
Constructor Summary | |
---|---|
TokenAuthenticationInvocationHandler()
|
Method Summary | |
---|---|
protected ConfluenceUser |
getAuthenticatedUser(java.lang.String token)
Determines which user is performing the request. |
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
|
protected java.lang.Object |
invokeAuthenticatedMethod(ConfluenceUser user,
java.lang.reflect.Method method,
java.lang.Object[] args)
Sets the authenticated user to the provided user before calling the method and restores the original user afterwards. |
static java.lang.Object |
makeAuthenticatingProxy(java.lang.Object rpcService,
java.lang.Class publishedInterface)
|
void |
setTokenAuthenticationManager(TokenAuthenticationManager tokenAuthenticationManager)
|
void |
setWrappedObject(java.lang.Object wrappedObject)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TokenAuthenticationInvocationHandler()
Method Detail |
---|
public static java.lang.Object makeAuthenticatingProxy(java.lang.Object rpcService, java.lang.Class publishedInterface)
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
invoke
in interface java.lang.reflect.InvocationHandler
java.lang.Throwable
protected java.lang.Object invokeAuthenticatedMethod(ConfluenceUser user, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
user
- the user who is executing the methodmethod
- the method to executeargs
- any arguments to the method
java.lang.Throwable
- rethrows any exception thrown by the invoked methodAuthenticatedUserThreadLocal
protected ConfluenceUser getAuthenticatedUser(java.lang.String token) throws InvalidSessionException, NotPermittedException
Determines which user is performing the request. It attempts, in order:
Returns the authenticated user.
token
- the authentication token
InvalidSessionException
- if the provided token is invalid
NotPermittedException
- if we need to fall back to the anonymous user, but anonymous
access to the remote API is disabledpublic void setWrappedObject(java.lang.Object wrappedObject)
public void setTokenAuthenticationManager(TokenAuthenticationManager tokenAuthenticationManager)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |