Interface OAuthServerDescription
public interface OAuthServerDescription
The description of an OAuth authentication server
- Since:
- 4.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classcache 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 OAuthServerDescriptionFOR INTERNAL USE ONLY Get OAuthServerDescription with the given name from cache@Nonnull StringgetAuthenticationURL(@Nonnull com.inet.authentication.AuthenticationDescription config) The URL of the authentication redirect without parameters.default @Nonnull StringgetAuthenticationURL(@Nonnull com.inet.authentication.AuthenticationDescription config, String redirectURL, String state) Add the needed parameters to the authentication redirect URL.default @Nullable InputStreamAlternative method to request the avatar icon.default @Nullable StringGet the color as hex value, e.g.default URLConnectiongetDataConnection(@Nonnull com.inet.authentication.AuthenticationDescription config, String accessToken) Get the URLConnection for user information.default @Nullable StringgetIconURL(@Nullable Map<String, String> settings) Get the Icon resource URL.default @Nullable StringgetLoginDisplayName(@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 StringGet the name of the related OauthConnectionProvider from the 'oauth.connection' plugin.default @Nonnull StringgetScope(@Nonnull com.inet.authentication.AuthenticationDescription config) Get the scope value.default @Nonnull StringgetTokenData(@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 booleanIf this provider has related settings in the 'oauth.connection' plugin.default booleanisTrustAllCerificates(@Nonnull com.inet.authentication.AuthenticationDescription config) Use the authentication server a private certificate and we should trust all certificates.@Nonnull Stringname()Get the loginSource/name for this server.default voidtransformGuiProperties(@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
-
CLIENT_SECRET
-
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
@Nonnull String name()Get the loginSource/name for this server.- Returns:
- the login source
- Since:
- 4.0
-
getColor
-
getIconURL
-
getScope
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
default @Nonnull 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 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
default @Nonnull 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 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 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
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 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
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. 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
-
applySettings
default @Nonnull 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 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 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 settingsclientProperties- properties from the GUI- Returns:
- the values to be saved
- Since:
- 24.4
-