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

com.launchdarkly.sdk.server.interfaces.HttpAuthentication Maven / Gradle / Ivy

There is a newer version: 7.5.0
Show newest version
package com.launchdarkly.sdk.server.interfaces;

/**
 * Represents a supported method of HTTP authentication, including proxy authentication.
 * 
 * @since 4.13.0
 */
public interface HttpAuthentication {
  /**
   * Computes the {@code Authorization} or {@code Proxy-Authorization} header for an authentication challenge.
   * 
   * @param challenges the authentication challenges provided by the server, if any (may be empty if this is
   *   pre-emptive authentication) 
   * @return the value for the authorization request header
   */
  String provideAuthorization(Iterable challenges);
  
  /**
   * Properties of an HTTP authentication challenge.
   */
  public static class Challenge {
    private final String scheme;
    private final String realm;
    
    /**
     * Constructs an instance.
     * 
     * @param scheme the authentication scheme
     * @param realm the authentication realm or null
     */
    public Challenge(String scheme, String realm) {
      this.scheme = scheme;
      this.realm = realm;
    }
    
    /**
     * The authentication scheme, such as "basic".
     * @return the authentication scheme
     */
    public String getScheme() {  
      return scheme;
    }
    
    /**
     * The authentication realm, if any.
     * @return the authentication realm or null
     */
    public String getRealm() {
      return realm;
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy