All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.atlassian.usercontext.api.UserContext Maven / Gradle / Ivy

Go to download

Java library that implements the User Context spec for passing user context information between services

There is a newer version: 0.3.1
Show newest version
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();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy