private boolean findClaimInAssertion(org.opensaml.saml.saml1.core.Assertion assertion, URI claimURI) { List<org.opensaml.saml.saml1.core.AttributeStatement> attributeStatements = assertion.getAttributeStatements(); if (attributeStatements == null || attributeStatements.isEmpty()) { return false; } for (org.opensaml.saml.saml1.core.AttributeStatement statement : attributeStatements) { List<org.opensaml.saml.saml1.core.Attribute> attributes = statement.getAttributes(); for (org.opensaml.saml.saml1.core.Attribute attribute : attributes) { URI attributeNamespace = URI.create(attribute.getAttributeNamespace()); String desiredRole = attributeNamespace.relativize(claimURI).toString(); if (attribute.getAttributeName().equals(desiredRole) && attribute.getAttributeValues() != null && !attribute.getAttributeValues().isEmpty()) { return true; } } } return false; } }
private boolean findClaimInAssertion(org.opensaml.saml.saml1.core.Assertion assertion, URI claimURI) { List<org.opensaml.saml.saml1.core.AttributeStatement> attributeStatements = assertion.getAttributeStatements(); if (attributeStatements == null || attributeStatements.isEmpty()) { return false; } for (org.opensaml.saml.saml1.core.AttributeStatement statement : attributeStatements) { List<org.opensaml.saml.saml1.core.Attribute> attributes = statement.getAttributes(); for (org.opensaml.saml.saml1.core.Attribute attribute : attributes) { URI attributeNamespace = URI.create(attribute.getAttributeNamespace()); String desiredRole = attributeNamespace.relativize(claimURI).toString(); if (attribute.getAttributeName().equals(desiredRole) && attribute.getAttributeValues() != null && !attribute.getAttributeValues().isEmpty()) { return true; } } } return false; } }
protected String findClaimInAssertion(org.opensaml.saml.saml1.core.Assertion assertion, URI claimURI) { List<org.opensaml.saml.saml1.core.AttributeStatement> attributeStatements = assertion.getAttributeStatements(); if (attributeStatements == null || attributeStatements.isEmpty()) { return "Attribute " + claimURI + " not found in the SAMLAssertion"; } for (org.opensaml.saml.saml1.core.AttributeStatement statement : attributeStatements) { List<org.opensaml.saml.saml1.core.Attribute> attributes = statement.getAttributes(); for (org.opensaml.saml.saml1.core.Attribute attribute : attributes) { URI attributeNamespace = URI.create(attribute.getAttributeNamespace()); String desiredRole = attributeNamespace.relativize(claimURI).toString(); if (attribute.getAttributeName().equals(desiredRole) && attribute.getAttributeValues() != null && !attribute.getAttributeValues().isEmpty()) { return null; } } } return "Attribute " + claimURI + " not found in the SAMLAssertion"; } }
/** {@inheritDoc} */ @Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) { try { final AttributeStatement statement = buildAttributeStatement(profileRequestContext, getAttributeContext().getIdPAttributes().values()); if (statement == null) { log.debug("{} No AttributeStatement was built, nothing to do", getLogPrefix()); return; } final Assertion assertion = assertionLookupStrategy.apply(profileRequestContext); if (assertion == null) { log.error("Unable to obtain Assertion to modify"); ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX); return; } assertion.getAttributeStatements().add(statement); log.debug("{} Adding constructed AttributeStatement to Assertion {} ", getLogPrefix(), assertion.getID()); } catch (final AttributeEncodingException e) { ActionSupport.buildEvent(profileRequestContext, IdPEventIds.UNABLE_ENCODE_ATTRIBUTE); } } //CheckStyle: ReturnCount ON
protected List<ProcessedClaim> parseClaimsInAssertion(org.opensaml.saml.saml1.core.Assertion assertion) { List<org.opensaml.saml.saml1.core.AttributeStatement> attributeStatements = assertion.getAttributeStatements(); if (attributeStatements == null || attributeStatements.isEmpty()) { if (LOG.isLoggable(Level.FINEST)) {
protected List<ProcessedClaim> parseClaimsInAssertion(org.opensaml.saml.saml1.core.Assertion assertion) { List<org.opensaml.saml.saml1.core.AttributeStatement> attributeStatements = assertion.getAttributeStatements(); if (attributeStatements == null || attributeStatements.isEmpty()) { if (LOG.isLoggable(Level.FINEST)) {
subjectStatements.addAll(saml1.getSubjectStatements()); subjectStatements.addAll(saml1.getAuthenticationStatements()); subjectStatements.addAll(saml1.getAttributeStatements()); subjectStatements.addAll(saml1.getAuthorizationDecisionStatements()); for (SubjectStatement subjectStatement : subjectStatements) {
assertion.getAttributeStatements().stream().flatMap(attributeStatement -> attributeStatement.getAttributes().stream()).forEach(item -> { LOGGER.debug("Processed attribute: [{}]", item.getAttributeName()); final List<Object> itemList = item.getAttributeValues().stream()
assertion.getAttributeStatements().add(this.samlObjectBuilder.newAttributeStatement( subject, attributesToSend, this.defaultAttributeNamespace));
for (final AttributeStatement attributeStatement : assertion.getAttributeStatements()) { for (final Attribute item : attributeStatement.getAttributes()) { LOGGER.debug("Processed attribute: {}", item.getAttributeName());
@Override protected void prepareResponse(final Response response, final Map<String, Object> model) { final DateTime issuedAt = response.getIssueInstant(); final Service service = getAssertionFrom(model).getService(); final Authentication authentication = getPrimaryAuthenticationFrom(model); final String authenticationMethod = (String) authentication.getAttributes().get( SamlAuthenticationMetaDataPopulator.ATTRIBUTE_AUTHENTICATION_METHOD); final AuthenticationStatement authnStatement = this.samlObjectBuilder.newAuthenticationStatement( authentication.getAuthenticationDate().toDate(), authenticationMethod, getPrincipal(model).getId()); final Assertion assertion = this.samlObjectBuilder.newAssertion(authnStatement, this.issuer, issuedAt, this.samlObjectBuilder.generateSecureRandomId()); final Conditions conditions = this.samlObjectBuilder.newConditions(issuedAt, service.getId(), this.issueLength); assertion.setConditions(conditions); final Subject subject = this.samlObjectBuilder.newSubject(getPrincipal(model).getId()); final Map<String, Object> attributesToSend = prepareSamlAttributes(model, service); if (!attributesToSend.isEmpty()) { assertion.getAttributeStatements().add(this.samlObjectBuilder.newAttributeStatement( subject, attributesToSend, VALIDATION_SAML_ATTRIBUTE_NAMESPACE)); } response.setStatus(this.samlObjectBuilder.newStatus(StatusCode.SUCCESS, null)); response.getAssertions().add(assertion); }
assertion.getAttributeStatements().add(attrStatement);
: wrapper.getSaml1().getAttributeStatements()) { for (org.opensaml.saml.saml1.core.Attribute attribute : attributeStatement.getAttributes()) { if ("ActAs".equals(attribute.getAttributeName())) {
: wrapper.getSaml1().getAttributeStatements()) { for (org.opensaml.saml.saml1.core.Attribute attribute : attributeStatement.getAttributes()) { if ("ActAs".equals(attribute.getAttributeName())) {
assertion.getSaml1().getAttributeStatements();
samlCallback.getAttributeStatementData() ); saml1.getAttributeStatements().addAll(attributeStatements);
for (final AttributeStatement statement : assertion.getAttributeStatements()) { if (statement.getSubject() != null && statement.getSubject().getNameIdentifier() != null) { return statement.getSubject().getNameIdentifier().getFormat();
for (final AttributeStatement statement : assertion.getAttributeStatements()) { if (statement.getSubject() != null && statement.getSubject().getNameIdentifier() != null) { return statement.getSubject().getNameIdentifier().getValue();