ArrayList<Statement> statements = new ArrayList<Statement>();
statements.add(buildAuthenticationStatement(requestContext));
- statements.add(buildAttributeStatement(requestContext, "urn:oasis:names:tc:SAML:1.0:cm:sender-vouches"));
+ if (requestContext.getProfileConfiguration().includeAttributeStatement()) {
+ statements
+ .add(buildAttributeStatement(requestContext, "urn:oasis:names:tc:SAML:1.0:cm:sender-vouches"));
+ }
samlResponse = buildResponse(requestContext, statements);
} catch (ProfileException e) {
* @param requestContext current request context
*
* @return the created statement
+ *
+ * @throws ProfileException thrown if the authentication statement can not be created
*/
protected AuthenticationStatement buildAuthenticationStatement(ShibbolethSSORequestContext requestContext)
throws ProfileException {
if (authnManagerPath == null || decoder == null || encoder == null) {
throw new IllegalArgumentException("AuthN manager path, decoding, encoding bindings URI may not be null");
}
-
+
authenticationManagerPath = authnManagerPath;
decodingBinding = decoder;
encodingBinding = encoder;
authnContextDeclRefBuilder = (SAMLObjectBuilder<AuthnContextDeclRef>) getBuilderFactory().getBuilder(
AuthnContextDeclRef.DEFAULT_ELEMENT_NAME);
}
-
+
/**
* Convenience method for getting the SAML 2 AuthnStatement builder.
*
* @return SAML 2 AuthnStatement builder
*/
- public SAMLObjectBuilder<AuthnStatement> getAuthnStatementBuilder(){
+ public SAMLObjectBuilder<AuthnStatement> getAuthnStatementBuilder() {
return authnStatementBuilder;
}
-
+
/**
* Convenience method for getting the SAML 2 AuthnContext builder.
*
* @return SAML 2 AuthnContext builder
*/
- public SAMLObjectBuilder<AuthnContext> getAuthnContextBuilder(){
+ public SAMLObjectBuilder<AuthnContext> getAuthnContextBuilder() {
return authnContextBuilder;
}
-
+
/**
* Convenience method for getting the SAML 2 AuthnContextClassRef builder.
*
* @return SAML 2 AuthnContextClassRef builder
*/
- public SAMLObjectBuilder<AuthnContextClassRef> getAuthnContextClassRefBuilder(){
+ public SAMLObjectBuilder<AuthnContextClassRef> getAuthnContextClassRefBuilder() {
return authnContextClassRefBuilder;
}
-
+
/**
* Convenience method for getting the SAML 2 AuthnContextDeclRef builder.
*
* @return SAML 2 AuthnContextDeclRef builder
*/
- public SAMLObjectBuilder<AuthnContextDeclRef> getAuthnContextDeclRefBuilder(){
+ public SAMLObjectBuilder<AuthnContextDeclRef> getAuthnContextDeclRefBuilder() {
return authnContextDeclRefBuilder;
}
}
/**
- * Creates a {@link Saml2LoginContext} an sends the request off to the AuthenticationManager to begin the
- * process of authenticating the user.
+ * Creates a {@link Saml2LoginContext} an sends the request off to the AuthenticationManager to begin the process of
+ * authenticating the user.
*
* @param request current request
* @param response current response
ProfileResponse<ServletResponse> response) throws ProfileException {
HttpSession httpSession = ((HttpServletRequest) request.getRawRequest()).getSession(true);
-
+
Saml2LoginContext loginContext = (Saml2LoginContext) httpSession.getAttribute(LoginContext.LOGIN_CONTEXT_KEY);
httpSession.removeAttribute(LoginContext.LOGIN_CONTEXT_KEY);
-
+
SSORequestContext requestContext = buildRequestContext(loginContext, request, response);
Response samlResponse;
ArrayList<Statement> statements = new ArrayList<Statement>();
statements.add(buildAuthnStatement(requestContext));
- statements.add(buildAttributeStatement(requestContext));
+ if (requestContext.getProfileConfiguration().includeAttributeStatement()) {
+ statements.add(buildAttributeStatement(requestContext));
+ }
Subject assertionSubject = buildSubject(requestContext, "urn:oasis:names:tc:SAML:2.0:cm:bearer");
}
/** Represents the internal state of a SAML 2.0 SSO Request while it's being processed by the IdP. */
- protected class SSORequestContext extends
- SAML2ProfileRequestContext<AuthnRequest, Response, SSOConfiguration> {
+ protected class SSORequestContext extends SAML2ProfileRequestContext<AuthnRequest, Response, SSOConfiguration> {
/** Current login context. */
private Saml2LoginContext loginContext;
* @param request current profile request
* @param response current profile response
*/
- public SSORequestContext(ProfileRequest<ServletRequest> request,
- ProfileResponse<ServletResponse> response) {
+ public SSORequestContext(ProfileRequest<ServletRequest> request, ProfileResponse<ServletResponse> response) {
super(request, response);
}