Package com.webmethods.caf.wsserver.auth
Class DefaultAuthInterceptor
java.lang.Object
com.webmethods.caf.wsserver.auth.DefaultAuthInterceptor
- All Implemented Interfaces:
IWSServerAuthInterceptor
,electric.soap.ISOAPInterceptor
Soap header request interceptor that extracts a SAML artifact from the SOAP headers,
retrieves a SAML assertion and extracts the asserted user DN if SAML artifact is available.
If allowBasic
is set to true, and a SAML artifact isn't available, then fall back to basic
auth to the security provider
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultAuthInterceptor
(boolean allowBasic) Construct request interceptor and require than incoming SOAP messages must contain an artifact in the SOAP header.DefaultAuthInterceptor
(SAMLAssertionValidator samlValidator, electric.security.basic.BasicRealm basicRealmAuthenticator, String securityProviderEndpoint, boolean allowBasic) Construct request interceptor with the specified SAML security provider endpoint URL and specifying whether to enforce the SAML checkDefaultAuthInterceptor
(String securityProviderURL) Construct request interceptor with the specified SAML security provider endpoint URL.DefaultAuthInterceptor
(String securityProviderURL, boolean allowBasic) Construct request interceptor with the specified SAML security provider endpoint URL and specifying whether to enforce the SAML check -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Check if SOAP interception is required If Http session is already asserted, no interception is necessary.boolean
Whether this interceptor will allow anonymous accessboolean
Get the user dn of the user associated with the HTTP session of the current thread.electric.security.basic.BasicRealm
If IWSServerAuthInterceptor can be configured to allowBasic, then it must support instantiating one of theseprotected HttpSession
protected SAMLAssertionValidator
void
intercept
(electric.soap.SOAPMessage message, electric.util.Context messageContext) Implementation ofISOAPInterceptor
.protected boolean
Does the session contain the flag that we already have an asserted user for this Sessionprotected void
performIntercept
(Element textElement) Perform SOAP interception to verify the SAML assertion received in the SOAP header.void
setAllowAnonymous
(boolean allowAnonymous) Whether this interceptor will allow anonymous accessvoid
setAllowBasic
(boolean allowBasic) Modify the enforce allowBasic to verify SAML artifact.protected void
setAsserted
(boolean asserted) Set a value into the current session to flag that we have an asserted user and don't require validation on subsequent requestsprotected void
setSessionUser
(String username) Store the name of the asserted user in the Session
-
Constructor Details
-
DefaultAuthInterceptor
public DefaultAuthInterceptor(boolean allowBasic) Construct request interceptor and require than incoming SOAP messages must contain an artifact in the SOAP header.- Parameters:
allowBasic
- whether or not to allow fall back to basic auth
-
DefaultAuthInterceptor
Construct request interceptor with the specified SAML security provider endpoint URL. The presence of a SAML artifact in the SOAP header is not required.- Parameters:
securityProviderURL
- - The URL of the SAML security provider web service as a String
-
DefaultAuthInterceptor
Construct request interceptor with the specified SAML security provider endpoint URL and specifying whether to enforce the SAML check- Parameters:
securityProviderURL
- - The URL of the SAML security provider web service as a StringallowBasic
- whether or not to allow fall back to basic auth
-
DefaultAuthInterceptor
public DefaultAuthInterceptor(SAMLAssertionValidator samlValidator, electric.security.basic.BasicRealm basicRealmAuthenticator, String securityProviderEndpoint, boolean allowBasic) Construct request interceptor with the specified SAML security provider endpoint URL and specifying whether to enforce the SAML check
-
-
Method Details
-
intercept
public void intercept(electric.soap.SOAPMessage message, electric.util.Context messageContext) Implementation ofISOAPInterceptor
. This method intercepts the inbound SOAP message to retrieve the SAML artifact header element.- Specified by:
intercept
in interfaceelectric.soap.ISOAPInterceptor
- Parameters:
message
- theSOAPMessage
object.messageContext
- the context related to the SOAP message.
-
getBasicRealm
public electric.security.basic.BasicRealm getBasicRealm()Description copied from interface:IWSServerAuthInterceptor
If IWSServerAuthInterceptor can be configured to allowBasic, then it must support instantiating one of these- Specified by:
getBasicRealm
in interfaceIWSServerAuthInterceptor
-
setAllowBasic
public void setAllowBasic(boolean allowBasic) Modify the enforce allowBasic to verify SAML artifact. A true value forces SAML artifact handling always. Otherwise the handling is done only if the artifact is present.- Specified by:
setAllowBasic
in interfaceIWSServerAuthInterceptor
- Parameters:
allowBasic
- boolean set to true if SAML artifact verification is enforced, false otherwise.
-
getAllowBasic
public boolean getAllowBasic()- Specified by:
getAllowBasic
in interfaceIWSServerAuthInterceptor
- Returns:
- whether this allows basic auth
-
getAllowAnonymous
public boolean getAllowAnonymous()Whether this interceptor will allow anonymous access- Specified by:
getAllowAnonymous
in interfaceIWSServerAuthInterceptor
-
setAllowAnonymous
public void setAllowAnonymous(boolean allowAnonymous) Whether this interceptor will allow anonymous access- Specified by:
setAllowAnonymous
in interfaceIWSServerAuthInterceptor
-
doIntercept
protected boolean doIntercept()Check if SOAP interception is required If Http session is already asserted, no interception is necessary.- Returns:
- true if this SOAP message requires intercept (the Session doesn't contain an asserted user)
-
performIntercept
Perform SOAP interception to verify the SAML assertion received in the SOAP header. -
getSamlValidator
-
getAuthenticatedUserDN
Get the user dn of the user associated with the HTTP session of the current thread. However, if BasicAuth is used then you will only get a uid- Specified by:
getAuthenticatedUserDN
in interfaceIWSServerAuthInterceptor
- Returns:
String
m_name of the user
-
setAsserted
protected void setAsserted(boolean asserted) Set a value into the current session to flag that we have an asserted user and don't require validation on subsequent requests -
setSessionUser
Store the name of the asserted user in the Session -
isAssertedSession
protected boolean isAssertedSession()Does the session contain the flag that we already have an asserted user for this Session -
getHttpSession
- Returns:
- the HTTP session associated with the current thread.
-