uk.ac.starlink.auth

## Class BearerIvoaAuthScheme

- java.lang.Object
- - uk.ac.starlink.auth.IvoaAuthScheme
  - - uk.ac.starlink.auth.BearerIvoaAuthScheme

- All Implemented Interfaces:
    AuthScheme

      public class BearerIvoaAuthScheme
      extends IvoaAuthScheme

  IvoaAuthScheme concrete subclass for working with bearer tokens.

  This implements the "ivoa_bearer" scheme. The bearer token is acquired from the "X-VO-Bearer" header of the login response, and is subsequently used in accordance with RFC6750 like:

          Authorization: Bearer <token-text>

  Note that at time of writing it is not in general safe to use this scheme because the details of token scope have not been worked out, leading to the possibility of a third-party malevolent site issuing a challenge that would result in stealing tokens.

  Since:
    10 Dec 2021
  See Also:
    RFC 6750

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class uk.ac.starlink.auth.IvoaAuthScheme

      `IvoaAuthScheme.AuthReader<T>`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static BearerIvoaAuthScheme` | `INSTANCE` Singleton instance.
    `static java.lang.String` | `SCHEME_NAME` Name and identifier for this scheme ("ivoa_bearer").
    `static java.lang.String` | `TOKEN_HEADER` Name of login response header containing bearer token.

    - ### Fields inherited from class uk.ac.starlink.auth.IvoaAuthScheme

      `ACCESSURL_PARAM, STANDARDID_PARAM`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ContextFactory` | `createContextFactory(LoginProtocol loginProto, java.net.URL loginUrl, java.net.URL challengeUrl)` Creates a ContextFactory for this scheme with a given login protocol instance.

    - ### Methods inherited from class uk.ac.starlink.auth.IvoaAuthScheme

      `createContextFactory, getName, getSuccessResponse, readAuth`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### INSTANCE

          public static final BearerIvoaAuthScheme INSTANCE

      Singleton instance.

    - #### SCHEME_NAME

          public static final java.lang.String SCHEME_NAME

      Name and identifier for this scheme ("ivoa_bearer").
      See Also:
        Constant Field Values

    - #### TOKEN_HEADER

          public static final java.lang.String TOKEN_HEADER

      Name of login response header containing bearer token.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### createContextFactory

          public ContextFactory createContextFactory(LoginProtocol loginProto,
                                                     java.net.URL loginUrl,
                                                     java.net.URL challengeUrl)

      Description copied from class: `IvoaAuthScheme`
      Creates a ContextFactory for this scheme with a given login protocol instance. The return value should generally not be null, since if it's got as far as this call, the challenge looks like it's intended for this scheme.
      Specified by:
        `createContextFactory` in class `IvoaAuthScheme`
      Parameters:
        `loginProto` - login protocol
        `loginUrl` - login URL
        `challengeUrl` - URL from which the challenge was received
      Returns:
        context factory