Class BearerToken

java.lang.Object
sonia.scm.security.BearerToken
All Implemented Interfaces:
Serializable, org.apache.shiro.authc.AuthenticationToken

public final class BearerToken extends Object implements org.apache.shiro.authc.AuthenticationToken
Token used for authentication with bearer tokens.
Since:
2.0.0
See Also:
  • Method Details

    • getCredentials

      public String getCredentials()
      Returns the wrapped raw format of the token.
      Specified by:
      getCredentials in interface org.apache.shiro.authc.AuthenticationToken
    • getPrincipal

      public SessionId getPrincipal()
      Returns the session id or null.
      Specified by:
      getPrincipal in interface org.apache.shiro.authc.AuthenticationToken
    • valueOf

      public static BearerToken valueOf(String raw)
      Creates a new BearerToken from raw string representation.
      Parameters:
      raw - string representation
    • create

      public static BearerToken create(@Nullable SessionId session, String rawToken)
      Creates a new BearerToken from raw string representation for the given ui session id.
      Parameters:
      session - session id of the client
      rawToken - bearer token string representation