Interface OAuthServerDescription
public interface OAuthServerDescription
The description of an OAuth authentication server
- Since:
- 4.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
cache for registered instances -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionapplySettings
(@Nonnull String loginType, @Nonnull Map<String, String> clientProperties) Convert the properties from the GUI to the properties that should be saved.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.static OAuthServerDescription
FOR INTERNAL USE ONLY Get OAuthServerDescription with the given name from cache@Nonnull String
getAuthenticationURL
(@Nonnull com.inet.authentication.AuthenticationDescription config) The URL of the authentication redirect without parameters.default @Nonnull String
getAuthenticationURL
(@Nonnull com.inet.authentication.AuthenticationDescription config, String redirectURL, String state) Add the needed parameters to the authentication redirect URL.default @Nullable InputStream
Alternative method to request the avatar icon.default @Nullable String
Get the color as hex value, e.g.default URLConnection
getDataConnection
(@Nonnull com.inet.authentication.AuthenticationDescription config, String accessToken) Get the URLConnection for user information.default @Nullable String
getIconURL
(@Nullable Map<String, String> settings) Get the Icon resource URL.default @Nullable 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.default @Nullable String
Get the name of the related OauthConnectionProvider from the 'oauth.connection' plugin.default @Nonnull String
getScope
(@Nonnull com.inet.authentication.AuthenticationDescription config) Get the scope value.default @Nonnull String
getTokenData
(@Nonnull com.inet.authentication.AuthenticationDescription config, String redirectURL, String code) The POST data to verify the login from the servergetTokenURL
(@Nonnull com.inet.authentication.AuthenticationDescription config) The POST URL to verify the login from the server.default boolean
If this provider has related settings in the 'oauth.connection' plugin.default boolean
isTrustAllCerificates
(@Nonnull com.inet.authentication.AuthenticationDescription config) Use the authentication server a private certificate and we should trust all certificates.@Nonnull String
name()
Get the loginSource/name for this server.default void
transformGuiProperties
(@Nonnull Map<String, Object> properties) Transform the loaded values to the format required for the configuration GUIupdateRoles
(@Nonnull String accessToken, @Nonnull Set<String> roles) Possible method to updates the roles which was received with JWT login token.
-
Field Details
-
CLIENT_ID
Key of the client-id property- See Also:
-
CLIENT_SECRET
Key of the client-secret property- See Also:
-
USE_OAUTH_CONNECTION
Key if the setting from 'oauth.connection' plugin is used- See Also:
-
OAUTH_CONNECTION
static final boolean OAUTH_CONNECTIONif oauth.connection plugin is loaded
-
-
Method Details
-
get
FOR INTERNAL USE ONLY Get OAuthServerDescription with the given name from cache- Parameters:
name
- the name- Returns:
- OAuthServerDescription or null
- Since:
- 23.10
-
name
Get the loginSource/name for this server.- Returns:
- the login source
- Since:
- 4.0
-
getColor
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
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 @Nonnull String getScope(@Nonnull @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 @Nonnull String getAuthenticationURL(@Nonnull @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 @Nonnull String getAuthenticationURL(@Nonnull @Nonnull com.inet.authentication.AuthenticationDescription config, String redirectURL, String state) Add the needed parameters to the authentication redirect URL.- Parameters:
config
- the current oauth configurationredirectURL
- the return URL of this serverstate
- a random state which need to verify later- Returns:
- the URL
- Since:
- 4.0
-
getTokenURL
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 @Nonnull String getTokenData(@Nonnull @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 configurationredirectURL
- the used callback URL. Must be the same from the authentication requestcode
- the code from the authentication server- Returns:
- the POST data
- Since:
- 4.0
-
getDataConnection
default URLConnection getDataConnection(@Nonnull @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 configurationaccessToken
- 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
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
-
updateRoles
@Nullable default @Nullable Set<String> updateRoles(@Nonnull @Nonnull String accessToken, @Nonnull @Nonnull Set<String> roles) Possible method to updates the roles which was received with JWT login token.- Parameters:
accessToken
- the valid accessToken from a previous authenticationroles
- the original requested roles- Returns:
- the updated roles
- Since:
- 24.10
-
isTrustAllCerificates
default boolean isTrustAllCerificates(@Nonnull @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 @Nullable String getLoginDisplayName(@Nullable @Nullable String email, @Nullable @Nullable String givenName, @Nullable @Nullable String familyName, @Nullable @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 emailgivenName
- possible given namefamilyName
- possible family namealternativeLoginID
- alternative login ID, depends the provider- Returns:
- alternative display name
- Since:
- 23.10
-
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
Transform the loaded values to the format required for the configuration GUI- Parameters:
properties
- the loaded properties- Since:
- 24.4
-
applySettings
@Nonnull default @Nonnull Map<String,String> applySettings(@Nonnull @Nonnull Map<String, String> clientProperties, @Nonnull @Nonnull com.inet.config.Configuration config, @Nonnull @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 GUIconfig
- the Configuration that will edit in the configuration manager GUIoriginalInConfig
- the parsed, read only login settings in configuration- Returns:
- the values to be saved
- Since:
- 24.4
-
applySettings
static Map<String,String> applySettings(@Nonnull @Nonnull String loginType, @Nonnull @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 settingsclientProperties
- properties from the GUI- Returns:
- the values to be saved
- Since:
- 24.4
-