Interface OAuthServerDescription


public interface OAuthServerDescription
The description of an OAuth authentication server
Since:
4.0
  • Field Details

    • CLIENT_ID

      static final String CLIENT_ID
      Key of the client-id property
      See Also:
    • CLIENT_SECRET

      static final String CLIENT_SECRET
      Key of the client-secret property
      See Also:
    • USE_OAUTH_CONNECTION

      static final String USE_OAUTH_CONNECTION
      Key if the setting from 'oauth.connection' plugin is used
      See Also:
    • OAUTH_CONNECTION

      static final boolean OAUTH_CONNECTION
      if oauth.connection plugin is loaded
  • Method Details

    • get

      static OAuthServerDescription get(@Nonnull String name)
      FOR INTERNAL USE ONLY Get OAuthServerDescription with the given name from cache
      Parameters:
      name - the name
      Returns:
      OAuthServerDescription or null
      Since:
      23.10
    • name

      @Nonnull String name()
      Get the loginSource/name for this server.
      Returns:
      the login source
      Since:
      4.0
    • getColor

      @Nullable default String getColor(@Nullable Map<String,String> settings)
      Get the color as hex value, e.g. "#ff00ee". If null the default color is used.
      Parameters:
      settings - the settings in the configuration manager
      Returns:
      the color
      Since:
      21.4
    • getIconURL

      @Nullable default String getIconURL(@Nullable Map<String,String> settings)
      Get the Icon resource URL. If null the default Icon is used.
      Parameters:
      settings - the settings in the configuration manager
      Returns:
      the url
      Since:
      21.4
    • getScope

      @Nonnull default String getScope(@Nonnull com.inet.authentication.AuthenticationDescription config)
      Get the scope value. The scope are the data which we want grand access.
      Parameters:
      config - the current oauth configuration
      Returns:
      the scope parameter
      Since:
      4.0
    • getAuthenticationURL

      @Nonnull String getAuthenticationURL(@Nonnull com.inet.authentication.AuthenticationDescription config)
      The URL of the authentication redirect without parameters. This is the first URL to which the browser will be redirect.
      Parameters:
      config - the current configuration
      Returns:
      the URL
      Since:
      4.0
    • getAuthenticationURL

      @Nonnull default String getAuthenticationURL(@Nonnull com.inet.authentication.AuthenticationDescription config, String redirectURL, String state)
      Add the needed parameters to the authentication redirect URL.
      Parameters:
      config - the current oauth configuration
      redirectURL - the return URL of this server
      state - a random state which need to verify later
      Returns:
      the URL
      Since:
      4.0
    • getTokenURL

      String getTokenURL(@Nonnull com.inet.authentication.AuthenticationDescription config)
      The POST URL to verify the login from the server.
      Parameters:
      config - the current oauth configuration
      Returns:
      the URL
      Since:
      4.0
    • getTokenData

      @Nonnull default String getTokenData(@Nonnull com.inet.authentication.AuthenticationDescription config, String redirectURL, String code)
      The POST data to verify the login from the server
      Parameters:
      config - the current OAuth configuration
      redirectURL - the used callback URL. Must be the same from the authentication request
      code - the code from the authentication server
      Returns:
      the POST data
      Since:
      4.0
    • getDataConnection

      default URLConnection getDataConnection(@Nonnull com.inet.authentication.AuthenticationDescription config, String accessToken) throws IOException
      Get the URLConnection for user information. This connection is only if the provider does not support OpenID or for use of access tokens in web API requests.
      Parameters:
      config - the current OAuth configuration
      accessToken - the valid accessToken from a previous authentication
      Returns:
      The URL to request the data.
      Throws:
      IOException - if any I/O error occur
      Since:
      20.4
    • getAvatar

      @Nullable default InputStream getAvatar(String accessToken)
      Alternative method to request the avatar icon. Only called for new users
      Parameters:
      accessToken - the valid accessToken from a previous authentication
      Returns:
      the stream to an image
      Since:
      23.10
    • isTrustAllCerificates

      default boolean isTrustAllCerificates(@Nonnull com.inet.authentication.AuthenticationDescription config)
      Use the authentication server a private certificate and we should trust all certificates. Default is false.
      Parameters:
      config - the current OAuth configuration
      Returns:
      true for private certificates
      Since:
      4.0
    • getLoginDisplayName

      @Nullable default String getLoginDisplayName(@Nullable String email, @Nullable String givenName, @Nullable String familyName, @Nullable String alternativeLoginID)
      Get the display name of the login in the user manager. If null then the login id will be show. The default implementation will try to create a display name in the form:

      FirstName LastName <Email>

      • If only First or Last name are given, they will prefix the email (if given)
      • If only the email is given, then only the email will be returned.
      • If none of those are given, null is returned and results in the original login id
      Parameters:
      email - possible email
      givenName - possible given name
      familyName - possible family name
      alternativeLoginID - alternative login ID, depends the provider
      Returns:
      alternative display name
      Since:
      23.10
    • getOauthConnectionProvider

      @Nullable default String getOauthConnectionProvider()
      Get the name of the related OauthConnectionProvider from the 'oauth.connection' plugin.
      Returns:
      the name or null
      Since:
      23.10
    • hasOauthConnectionSettings

      default boolean hasOauthConnectionSettings()
      If this provider has related settings in the 'oauth.connection' plugin.
      Returns:
      true, if plugin is available and there are configure settings in the 'oauth.connection' plugin.
      Since:
      23.10
    • transformGuiProperties

      default void transformGuiProperties(@Nonnull Map<String,Object> properties)
      Transform the loaded values to the format required for the configuration GUI
      Parameters:
      properties - the loaded properties
      Since:
      24.4
    • applySettings

      @Nonnull default Map<String,String> applySettings(@Nonnull Map<String,String> clientProperties, @Nonnull com.inet.config.Configuration config, @Nonnull List<Map<String,String>> originalInConfig)
      Convert the properties from the GUI to the properties that should be saved. Typical this is a filter only.
      Parameters:
      clientProperties - properties from the GUI
      config - the Configuration that will edit in the configuration manager GUI
      originalInConfig - the parsed, read only login settings in configuration
      Returns:
      the values to be saved
      Since:
      24.4
    • applySettings

      static Map<String,String> applySettings(@Nonnull String loginType, @Nonnull Map<String,String> clientProperties)
      Convert the properties from the GUI to the properties that should be saved. Typical this is a filter only.
      Parameters:
      loginType - the login type prefix name to check for additional settings
      clientProperties - properties from the GUI
      Returns:
      the values to be saved
      Since:
      24.4