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 booleanisTrustAllCertificates(@Nonnull com.inet.authentication.AuthenticationDescription config) Determines whether all certificates should be trusted for the authentication server.@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) Optional method to update the roles received with the 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 scopes are the data to which access is requested.- 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 redirected.- 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 that must be verified 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 used if the provider does not support OpenID or if access tokens are used for web API requests.- Parameters:
config- the current OAuth configurationaccessToken- the valid accessToken from a previous authentication- Returns:
- The connection used to request the data.
- Throws:
IOException- if any I/O error occurs- 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
Optional method to update the roles received with the JWT login token.- Parameters:
accessToken- the valid accessToken from a previous authenticationroles- the original requested roles- Returns:
- the updated roles
- Since:
- 24.10
-
isTrustAllCertificates
default boolean isTrustAllCertificates(@Nonnull com.inet.authentication.AuthenticationDescription config) Determines whether all certificates should be trusted for the authentication server.This correctly spelled method is the preferred override and call site for new code. Its default implementation delegates to the legacy misspelled method so existing provider implementations continue to work.
- Parameters:
config- the current OAuth configuration- Returns:
- true for private certificates
- Since:
- 26.10
-
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 shown. 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 on 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 configured 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
-