Package io.deephaven.enterprise.samlauth
Class SAMLAuthModule
java.lang.Object
io.deephaven.enterprise.samlauth.SAMLAuthModule
- All Implemented Interfaces:
AuthModule
A server-side authentication module which permits external SAML-based authentication to grant access to the system
-
Constructor Summary
ConstructorsConstructorDescriptionSAMLAuthModule(com.fishlib.io.logger.Logger log, LocalAuthenticationServer localAuthenticationServer) Create an instance of this class, including the embedded jetty instance -
Method Summary
Modifier and TypeMethodDescriptionvoidaddKnownRequest(@NotNull String requestId, @NotNull String nonce) Keep a map of nonce->requestId for the life of this process.voidAdd the user-provided nonce to the authEntries map as a successful entry.voidcheckKnownRequest(@NotNull String requestId, @NotNull String nonce) Upon IdP response, we use this method to verify that the nonce->requestId map has been declared in advance.voidfailNewKey(@NotNull String nonce) Add the user-provided nonce to the authEntries map as a failed entry.static longstatic booleanstatic Stringstatic booleangetNameFromExternal(String nonce) This method is called by the auth-server when the front-end authentication-request is received.com.onelogin.saml2.settings.Saml2SettingsReturns a number of pre-defined Properties used to determine the behavior of our onelogin-toolkit instancesstatic Stringstatic Stringstatic StringgetSamlOnLogonUrl(jakarta.servlet.http.HttpServletRequest request) static intstatic booleanbooleanisUserPassValid(String username, String password) Not used by this module; return falsestatic voidTesting utility - run a standalone SAMLAuthModule and print out registered (success and fail) AuthEntry objectsbooleanmayRedirectTo(String redirectUrl) Used to ensure that a client-requested redirect-URL is permitted by configurationvoidStop the embedded jetty serverbooleanuserExists(String username) Only used by this module when group synchronization is enabled.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.iris.auth.AuthModule
getUserByPublicKey
-
Constructor Details
-
SAMLAuthModule
public SAMLAuthModule(com.fishlib.io.logger.Logger log, LocalAuthenticationServer localAuthenticationServer) throws Exception Create an instance of this class, including the embedded jetty instance- Parameters:
log- the logger to use.localAuthenticationServer- the local authentication server, if any- Throws:
Exception- if any error preventing startup
-
-
Method Details
-
getSamlOnLogonUrl
-
getSamlDoLoginPath
-
getSamlOnLoginPath
-
getExpiration
public static long getExpiration() -
getSessionTimeout
public static int getSessionTimeout() -
getIdPrefix
-
getForceAuthn
public static boolean getForceAuthn() -
getIsPassive
public static boolean getIsPassive() -
getSetNameIdPolicy
public static boolean getSetNameIdPolicy() -
main
Testing utility - run a standalone SAMLAuthModule and print out registered (success and fail) AuthEntry objects- Parameters:
args- Ignored- Throws:
Exception- if any error during run
-
stopServer
public void stopServer()Stop the embedded jetty server -
getSaml2Settings
public com.onelogin.saml2.settings.Saml2Settings getSaml2Settings()Returns a number of pre-defined Properties used to determine the behavior of our onelogin-toolkit instances- Returns:
- a valid onelogin Saml2Settings object used to identify saml properties
-
mayRedirectTo
Used to ensure that a client-requested redirect-URL is permitted by configuration- Parameters:
redirectUrl- URL to which the client has requested redirection upon completion of the authentication cycle- Returns:
- true if the client-requested redirectUrl is permitted by configuration, else false
- Throws:
URISyntaxException- if there is any error parsing the input string
-
addKnownRequest
Keep a map of nonce->requestId for the life of this process. It is highly unlikely that a duplicated nonce is legitimately created by the client-side process, so we use this to identify and prevent replay-attack attemptsIn the unlikely scenario that a nonce is legitimately duplicated, the client-login attempt will fail, at which point they may try again (with a new nonce)
- Parameters:
requestId- the request-id associated with nonce; we will only accept a response from the IdP for this specific ID to match the given noncenonce- a one-time-use key that we will register. Any attempt to register this key again will result in an exception
-
checkKnownRequest
Upon IdP response, we use this method to verify that the nonce->requestId map has been declared in advance. This should mitigate replay-attack attempts, and ensure that the front-end request is tied to a single saml request- Parameters:
requestId- the request-id associated with noncenonce- the one-time-use key which we will use to verify against the requestId for sanity
-
addNewKey
Add the user-provided nonce to the authEntries map as a successful entry. This will permit the client's authentication-request to be successful- Parameters:
expireTime- the time, in milliseconds, when this key becomes invaliduserName- the authenticated user-namenonce- the user-supplied key which will tie the eventual authentication-request to the saml-request
-
failNewKey
Add the user-provided nonce to the authEntries map as a failed entry. This allows the server to respond back to the front-end with a rejection instead of waiting for the natural timeout- Parameters:
nonce- the user-supplied key which will tie the eventual authentication-request to the saml-request
-
getNameFromExternal
This method is called by the auth-server when the front-end authentication-request is received. In the case that the saml-request is completed successfully, this method will return the IdP-provided iris-name back to the main server for further authentication (userExists)- Specified by:
getNameFromExternalin interfaceAuthModule- Parameters:
nonce- the user-supplied key in the authentication-request- Returns:
- the IdP-provided iris-name on success, else null
-
userExists
Only used by this module when group synchronization is enabled. Otherwise, this module returnsfalseand user existence is determined by the rest of the logic inAuthenticationServerBase.userExists(java.lang.String)(i.e., everything that method does except callingSAMLAuthModule#userExists-- such as callinguserExists()from other auth modules.- Specified by:
userExistsin interfaceAuthModule- Parameters:
username- The username whose existence should be verified.- Returns:
falseifgroupProvideris null (i.e., if group synchronization is disabled). Otherwise, returnstrueif the groups list forusernameincludes a group namedusernameitself. (In other words, it makes sure that the user is a member of "their own group".
-
isUserPassValid
Not used by this module; return false- Specified by:
isUserPassValidin interfaceAuthModule- Parameters:
username- not usedpassword- not used- Returns:
- always false
-