/** {@inheritDoc} */ protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException { NameIdentifier nameIdentifier = (NameIdentifier) samlObject; if (nameIdentifier.getNameIdentifier() != null) { XMLHelper.appendTextContent(domElement, nameIdentifier.getNameIdentifier()); } } }
/** * Builds a name ID. The provided value is the textual content of the NameIdentifier. If a {@link #nameIdQualifier} * is not null it is used as the NameIdentifier's name qualifier, otherwise the attribute issuer's entity id is * used. * * @param nameIdValue value of the NameIdentifier * @param resolutionContext current resolution context * * @return the constructed NameIdentifier */ protected NameIdentifier buildNameId(String nameIdValue, ShibbolethResolutionContext resolutionContext) { NameIdentifier nameId = nameIdBuilder.buildObject(); nameId.setNameIdentifier(nameIdValue); if (nameIdFormat != null) { nameId.setFormat(nameIdFormat); } if (nameIdQualifier != null) { nameId.setNameQualifier(nameIdQualifier); } else { nameId.setNameQualifier(resolutionContext.getAttributeRequestContext().getLocalEntityId()); } return nameId; }
/** {@inheritDoc} */ protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException { NameIdentifier nameIdentifier = (NameIdentifier) samlElement; if (nameIdentifier.getNameQualifier() != null) { domElement .setAttributeNS(null, NameIdentifier.NAMEQUALIFIER_ATTRIB_NAME, nameIdentifier.getNameQualifier()); } if (nameIdentifier.getFormat() != null) { domElement.setAttributeNS(null, NameIdentifier.FORMAT_ATTRIB_NAME, nameIdentifier.getFormat()); } }
/** * Create named identifier. * @param principalName Name of the subject. * @param format Format of the subject, whether it is an email, uid etc ... * @return The NamedIdentifier object. * @throws org.apache.rahas.TrustException If unable to find the builder. */ public static NameIdentifier createNamedIdentifier(String principalName, String format) throws TrustException{ NameIdentifier nameId = (NameIdentifier)CommonUtil.buildXMLObject(NameIdentifier.DEFAULT_ELEMENT_NAME); nameId.setNameIdentifier(principalName); nameId.setFormat(format); return nameId; }
/** {@inheritDoc} */ protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException { NameIdentifier nameIdentifier = (NameIdentifier) samlObject; if (NameIdentifier.FORMAT_ATTRIB_NAME.equals(attribute.getLocalName())) { nameIdentifier.setFormat(attribute.getValue()); } else if (NameIdentifier.NAMEQUALIFIER_ATTRIB_NAME.equals(attribute.getLocalName())) { nameIdentifier.setNameQualifier(attribute.getValue()); } else { super.processAttribute(samlObject, attribute); } }
/** {@inheritDoc} */ protected void processElementContent(XMLObject samlObject, String elementContent) { NameIdentifier nameIdentifier = (NameIdentifier) samlObject; nameIdentifier.setNameIdentifier(elementContent); } }
NameIdentifier nameId = (NameIdentifier) requestContext.getSubjectNameIdentifier(); if (nameId != null) { transientId = nameId.getNameIdentifier(); nameQualifier = nameId.getNameQualifier();
/** * Gets the format of the name identifier used to identify the subject. * * @param nameIdentifier name identifier used to identify the subject * * @return format of the name identifier used to identify the subject */ protected String getNameIdentifierFormat(SAMLObject nameIdentifier) { String subjectNameFormat = null; if (nameIdentifier instanceof NameIdentifier) { NameIdentifier identifier = (NameIdentifier) nameIdentifier; subjectNameFormat = identifier.getFormat(); } else if (nameIdentifier instanceof NameID) { NameID identifier = (NameID) nameIdentifier; subjectNameFormat = identifier.getFormat(); } if (DatatypeHelper.isEmpty(subjectNameFormat)) { subjectNameFormat = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"; } return subjectNameFormat; }
private Subject newSubject(final String identifier) { final SubjectConfirmation confirmation = newSamlObject(SubjectConfirmation.class); final ConfirmationMethod method = newSamlObject(ConfirmationMethod.class); method.setConfirmationMethod(CONFIRMATION_METHOD); confirmation.getConfirmationMethods().add(method); final NameIdentifier nameIdentifier = newSamlObject(NameIdentifier.class); nameIdentifier.setNameIdentifier(identifier); final Subject subject = newSamlObject(Subject.class); subject.setNameIdentifier(nameIdentifier); subject.setSubjectConfirmation(confirmation); return subject; }
/** {@inheritDoc} */ public NameIdentifier encode(BaseAttribute attribute) throws AttributeEncodingException { if (attribute.getValues() != null) { for (final Object value : attribute.getValues()) { // Check for null, empty, or solely whitespace. But don't trim the value encoded. final String valueStr = value.toString(); if (DatatypeHelper.safeTrimOrNullString(valueStr) != null) { NameIdentifier nameId = identifierBuilder.buildObject(); nameId.setNameIdentifier(valueStr); if (nameFormat != null) { nameId.setFormat(nameFormat); } if (nameQualifier != null) { nameId.setNameQualifier(nameQualifier); } return nameId; } } } throw new AttributeEncodingException(attribute.getId() + " attribute does not contain any non-empty values to encode"); }
/** {@inheritDoc} */ public String resolve(ShibbolethResolutionContext resolutionContext) throws AttributeResolutionException { SAMLObject nameIdentifier = resolutionContext.getAttributeRequestContext().getSubjectNameIdentifier(); if (nameIdentifier instanceof NameIdentifier) { return ((NameIdentifier) nameIdentifier).getNameIdentifier(); } else if (nameIdentifier instanceof NameID) { return ((NameID) nameIdentifier).getValue(); } else { return null; } }
ConfirmationMethod confirmationMethod = confirmationMethodV1Builder.buildObject(); nameIdentifier.setNameQualifier(subjectBean.getSubjectNameQualifier()); nameIdentifier.setNameIdentifier(subjectBean.getSubjectName()); nameIdentifier.setFormat(subjectBean.getSubjectNameIDFormat()); String confirmationMethodStr = subjectBean.getSubjectConfirmationMethod();
subject = authenticationStatement.getSubject(); if (subject != null) { String resourceOwnerUserName = subject.getNameIdentifier().getNameIdentifier(); if (resourceOwnerUserName == null || resourceOwnerUserName.equals("")) { if (log.isDebugEnabled()) {
ConfirmationMethod confirmationMethod = confirmationMethodV1Builder.buildObject(); nameIdentifier.setNameQualifier(subjectBean.getSubjectNameQualifier()); nameIdentifier.setNameIdentifier(subjectBean.getSubjectName()); nameIdentifier.setFormat(subjectBean.getSubjectNameIDFormat()); String confirmationMethodStr = subjectBean.getSubjectConfirmationMethod();
subject = authenticationStatement.getSubject(); if (subject != null) { String resourceOwnerUserName = subject.getNameIdentifier().getNameIdentifier(); if (resourceOwnerUserName == null || resourceOwnerUserName.equals("")) { if (log.isDebugEnabled()) {
persistentId = ((NameIdentifier) requestContext.getSubjectNameIdentifier()).getNameIdentifier(); } else if (requestContext.getSubjectNameIdentifier() instanceof NameID) { persistentId = ((NameID) requestContext.getSubjectNameIdentifier()).getValue();
NameIdentifier nameId = (NameIdentifier) requestContext.getSubjectNameIdentifier(); if (nameId != null) { transientId = nameId.getNameIdentifier();
name = samlSubject.getNameIdentifier().getNameIdentifier();
name = samlSubject.getNameIdentifier().getNameIdentifier();