|
||||||||||
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 com.atlassian.user.User |
getAuthenticatedUser(String token)
Determines which user is performing the request. |
Object |
invoke(Object proxy,
Method method,
Object[] args)
|
protected Object |
invokeAuthenticatedMethod(com.atlassian.user.User user,
Method method,
Object[] args)
Sets the authenticated user to the provided user before calling the method and restores the original user afterwards. |
static Object |
makeAuthenticatingProxy(Object rpcService,
Class publishedInterface)
|
void |
setTokenAuthenticationManager(TokenAuthenticationManager tokenAuthenticationManager)
|
void |
setWrappedObject(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 Object makeAuthenticatingProxy(Object rpcService, Class publishedInterface)
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke
in interface InvocationHandler
Throwable
protected Object invokeAuthenticatedMethod(com.atlassian.user.User user, Method method, Object[] args) throws Throwable
user
- the user who is executing the methodmethod
- the method to executeargs
- any arguments to the method
Throwable
- rethrows any exception thrown by the invoked methodAuthenticatedUserThreadLocal
protected com.atlassian.user.User getAuthenticatedUser(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(Object wrappedObject)
public void setTokenAuthenticationManager(TokenAuthenticationManager tokenAuthenticationManager)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |