Class TokenBasedAuthenticationInformation

java.lang.Object
se.liu.ida.hefquin.federation.authentication.TokenBasedAuthenticationInformation
All Implemented Interfaces:
AuthenticationInformation

public class TokenBasedAuthenticationInformation extends Object implements AuthenticationInformation
Authentication information for token-based authentication.

The token is applied to outgoing HTTP requests using an Authorization header with the configured authentication scheme. This class supports applying the authentication information to different HTTP request representations used by HeFQUIN.

  • Constructor Details

    • TokenBasedAuthenticationInformation

      public TokenBasedAuthenticationInformation(String authenticationScheme, String token)
  • Method Details

    • getAuthenticationScheme

      public String getAuthenticationScheme()
    • getToken

      public String getToken()
    • applyTo

      public void applyTo(HttpRequest.Builder builder)
      Adds the authentication scheme and token as an Authorization header to the given HTTP request builder.
      Specified by:
      applyTo in interface AuthenticationInformation
      Parameters:
      builder - HTTP request builder to which the Authorization header is added
    • applyTo

      public void applyTo(Map<String,String> headers)
      Adds the authentication scheme and token as an Authorization header to the given HTTP headers.
      Specified by:
      applyTo in interface AuthenticationInformation
      Parameters:
      headers - HTTP headers to which the Authorization header is added
    • applyTo

      public void applyTo(org.apache.jena.sparql.exec.http.QueryExecutionHTTPBuilder b)
      Adds the authentication scheme and token as an Authorization header to the given HTTP headers.
      Specified by:
      applyTo in interface AuthenticationInformation
      Parameters:
      b - QueryExecutionHTTPBuilder to which the Authorization header is added
    • checkForCompleteness

      public void checkForCompleteness() throws IncompleteAuthenticationInformationError
      Checks that the required token is available.
      Specified by:
      checkForCompleteness in interface AuthenticationInformation
      Throws:
      IncompleteAuthenticationInformationError - if the token is not available