String samlSubject = ((NameIDType) samlSubjectType.getSubType().getBaseID()).getValue();
NameIDType nameID = (NameIDType) subject.getSubType().getBaseID();
NameIDType nameID = (NameIDType) subject.getSubType().getBaseID();
NameIDType nameID = (NameIDType) subject.getSubType().getBaseID();
NameIDType nameID = (NameIDType) subject.getSubType().getBaseID();
/** * Consumes the assertion, resulting in the extraction of the Subject as the JAAS principal and the Role Statements as the JAAS * roles. * * @param assertion * * @throws Exception */ private void consumeAssertion(AssertionType assertion) throws Exception { SubjectType samlSubjectType = assertion.getSubject(); String samlSubject = ((NameIDType) samlSubjectType.getSubType().getBaseID()).getValue(); identity = createIdentity(samlSubject); Set<StatementAbstractType> statements = assertion.getStatements(); for (StatementAbstractType statement : statements) { if (statement instanceof AttributeStatementType) { AttributeStatementType attrStatement = (AttributeStatementType) statement; List<ASTChoiceType> attributes = attrStatement.getAttributes(); for (ASTChoiceType astChoiceType : attributes) { if (astChoiceType.getAttribute() != null && astChoiceType.getAttribute().getName().equals("Role")) { List<Object> values = astChoiceType.getAttribute().getAttributeValue(); for (Object roleValue : values) { if (roleValue != null) { roles.add(roleValue.toString()); } } } } } } }
/** * Consumes the assertion, resulting in the extraction of the Subject as the * JAAS principal and the Role Statements as the JAAS roles. * @param assertion * @throws Exception */ private void consumeAssertion(AssertionType assertion) throws Exception { SubjectType samlSubjectType = assertion.getSubject(); String samlSubject = ((NameIDType) samlSubjectType.getSubType().getBaseID()).getValue(); identity = createIdentity(samlSubject); Set<StatementAbstractType> statements = assertion.getStatements(); for (StatementAbstractType statement : statements) { if (statement instanceof AttributeStatementType) { AttributeStatementType attrStatement = (AttributeStatementType) statement; List<ASTChoiceType> attributes = attrStatement.getAttributes(); for (ASTChoiceType astChoiceType : attributes) { if (astChoiceType.getAttribute() != null && astChoiceType.getAttribute().getName().equals("Role")) { //$NON-NLS-1$ List<Object> values = astChoiceType.getAttribute().getAttributeValue(); for (Object roleValue : values) { if (roleValue != null) { roles.add(roleValue.toString()); } } } } } } }
/** * Consumes the assertion, resulting in the extraction of the Subject as the JAAS principal and the Role Statements as the JAAS * roles. * * @param assertion * * @throws Exception */ private void consumeAssertion(AssertionType assertion) throws Exception { SubjectType samlSubjectType = assertion.getSubject(); String samlSubject = ((NameIDType) samlSubjectType.getSubType().getBaseID()).getValue(); identity = createIdentity(samlSubject); Set<StatementAbstractType> statements = assertion.getStatements(); for (StatementAbstractType statement : statements) { if (statement instanceof AttributeStatementType) { AttributeStatementType attrStatement = (AttributeStatementType) statement; List<ASTChoiceType> attributes = attrStatement.getAttributes(); for (ASTChoiceType astChoiceType : attributes) { if (astChoiceType.getAttribute() != null && astChoiceType.getAttribute().getName().equals("Role")) { List<Object> values = astChoiceType.getAttribute().getAttributeValue(); for (Object roleValue : values) { if (roleValue != null) { roles.add(roleValue.toString()); } } } } } } }
String samlSubject = ((NameIDType) samlSubjectType.getSubType().getBaseID()).getValue();
public void performMapping(Map<String, Object> contextMap, Principal principal) { if (contextMap == null) { logger.mappingContextNull(); } Object tokenObject = contextMap.get(AbstractSTSLoginModule.SHARED_TOKEN); if (!(tokenObject instanceof Element)) { // With Tomcat SSO Valves, mapping providers DO get called automatically, so there may be no tokens and errors // should be expected and handled logger.debug("Did not find a token " + Element.class .getName() + " under " + AbstractSTSLoginModule.SHARED_TOKEN + " in the map"); } try { Element tokenElement = (Element) tokenObject; AssertionType assertion = SAMLUtil.fromElement(tokenElement); SubjectType subject = assertion.getSubject(); if (subject != null) { BaseIDAbstractType baseID = subject.getSubType().getBaseID(); if (baseID != null && baseID instanceof NameIDType) { NameIDType nameID = (NameIDType) baseID; Principal mappedPrincipal = new SimplePrincipal(nameID.getValue()); result.setMappedObject(mappedPrincipal); logger.trace("Mapped principal = " + mappedPrincipal); return; } } } catch (Exception e) { logger.samlAssertionPasingFailed(e); } }
public void performMapping(Map<String, Object> contextMap, Principal principal) { if (contextMap == null) { logger.mappingContextNull(); } Object tokenObject = contextMap.get(AbstractSTSLoginModule.SHARED_TOKEN); if (!(tokenObject instanceof Element)) { // With Tomcat SSO Valves, mapping providers DO get called automatically, so there may be no tokens and errors // should be expected and handled logger.debug("Did not find a token " + Element.class .getName() + " under " + AbstractSTSLoginModule.SHARED_TOKEN + " in the map"); } try { Element tokenElement = (Element) tokenObject; AssertionType assertion = SAMLUtil.fromElement(tokenElement); SubjectType subject = assertion.getSubject(); if (subject != null) { BaseIDAbstractType baseID = subject.getSubType().getBaseID(); if (baseID != null && baseID instanceof NameIDType) { NameIDType nameID = (NameIDType) baseID; Principal mappedPrincipal = new SimplePrincipal(nameID.getValue()); result.setMappedObject(mappedPrincipal); logger.trace("Mapped principal = " + mappedPrincipal); return; } } } catch (Exception e) { logger.samlAssertionPasingFailed(e); } }
throw new ProcessingException(ErrorCodes.NULL_VALUE + "Subject in the assertion"); STSubType subType = subject.getSubType(); if (subType == null) throw new RuntimeException(ErrorCodes.NULL_VALUE + "Unable to find subtype via subject");
StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.SUBJECT.get(), ASSERTION_NSURI.get()); STSubType subType = subject.getSubType(); if (subType != null) { BaseIDAbstractType baseID = subType.getBaseID();
StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.SUBJECT.get(), ASSERTION_NSURI.get()); STSubType subType = subject.getSubType(); if (subType != null) { BaseIDAbstractType baseID = subType.getBaseID();
STSubType subType = subject.getSubType(); if (subType != null)
StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.SUBJECT.get(), ASSERTION_NSURI.get()); STSubType subType = subject.getSubType(); if (subType != null) { BaseIDAbstractType baseID = subType.getBaseID();
STSubType subType = subject.getSubType(); if (subType != null)
throw logger.nullValueError("Subject in the assertion"); STSubType subType = subject.getSubType(); if (subType == null) throw logger.nullValueError("Unable to find subtype via subject");
throw logger.nullValueError("Subject in the assertion"); STSubType subType = subject.getSubType(); if (subType == null) throw logger.nullValueError("Unable to find subtype via subject");
throw logger.nullValueError("Subject in the assertion"); STSubType subType = subject.getSubType(); if (subType == null) throw logger.nullValueError("Unable to find subtype via subject");