com.atlassian.usercontext.api.UserContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of atlassian-user-context Show documentation
Show all versions of atlassian-user-context Show documentation
Java library that implements the User Context spec for passing user context information between services
package com.atlassian.usercontext.api;
import com.atlassian.asap.api.Jwt;
/**
* Represents the user-context token, which contains
*
* Reference: https://hello.atlassian.net/wiki/spaces/ARCH/pages/161912986/Specification+Standard+User+Context+Claims.
*/
public interface UserContext {
/**
* Get the user-context specific claims object, which contains accessors for all the
* claims in the specification.
*
* @return {@link UserContextClaims}
*/
UserContextClaims getUserContextClaims();
/**
* Get the account id for any user that is being impersonated within the context, or the account id claim if there is
* no user being impersonated.
*
* Currently the only supported context restriction is the raw cloud id of a site.
*
* @return {@link AccountId}
*/
AccountId resolveAccountId(String contextRestriction);
/**
* Get the underlying jwt deserialized from the signed token.
*
* @return {@link Jwt}
*/
Jwt getUserContextJwt();
/**
* Get the original signed token.
*
* This is necessary for forwarding the token to other services, which will independently
* verify the authenticity of the token.
*
* @return base64 encoded string representing original signed user-context jwt token
*/
String getSignedJwt();
}