use of org.keycloak.dom.saml.v2.assertion.NameIDType in project keycloak by keycloak.
the class AssertionUtil method createAssertionSubject.
/**
* Given a user name, create a {@code SubjectType} that can then be inserted into an assertion
*
* @param userName
*
* @return
*/
public static SubjectType createAssertionSubject(String userName) {
SubjectType assertionSubject = new SubjectType();
STSubType subType = new STSubType();
NameIDType anil = new NameIDType();
anil.setValue(userName);
subType.addBaseID(anil);
assertionSubject.setSubType(subType);
return assertionSubject;
}
use of org.keycloak.dom.saml.v2.assertion.NameIDType in project keycloak by keycloak.
the class AssertionUtil method createAssertion.
/**
* Create an assertion
*
* @param id
* @param issuer
*
* @return
*/
public static AssertionType createAssertion(String id, NameIDType issuer) {
XMLGregorianCalendar issueInstant = XMLTimeUtil.getIssueInstant();
AssertionType assertion = new AssertionType(id, issueInstant);
assertion.setIssuer(issuer);
return assertion;
}
use of org.keycloak.dom.saml.v2.assertion.NameIDType in project keycloak by keycloak.
the class SAMLAssertionFactory method createNameID.
/**
* <p>
* Creates a {@code NameIDType} instance with the specified values.
* </p>
*
* @param format a {@code String} representing the name format.
* @param qualifier a {@code String} representing the name qualifier.
* @param value a {@code String} representing the name value.
*
* @return the constructed {@code NameIDType} instance.
*/
public static NameIDType createNameID(String format, String qualifier, String value) {
NameIDType nameID = new NameIDType();
if (format != null)
nameID.setFormat(URI.create(format));
nameID.setNameQualifier(qualifier);
nameID.setValue(value);
return nameID;
}
use of org.keycloak.dom.saml.v2.assertion.NameIDType in project keycloak by keycloak.
the class SAMLAssertionFactory method createSubject.
/**
* <p>
* Creates a {@code SubjectType} object with the specified values.
* </p>
*
* @param nameID the identifier of the subject.
* @param confirmation the {@code SubjectConfirmationType} that is used to establish the correspondence between the
* subject
* and claims of SAML statements.
*
* @return the constructed {@code SubjectType} instance.
*/
public static SubjectType createSubject(NameIDType nameID, SubjectConfirmationType confirmation) {
SubjectType subject = new SubjectType();
if (nameID != null) {
SubjectType.STSubType subType = new SubjectType.STSubType();
subType.addConfirmation(confirmation);
subType.addBaseID(nameID);
subject.setSubType(subType);
}
return subject;
}
use of org.keycloak.dom.saml.v2.assertion.NameIDType in project keycloak by keycloak.
the class SAMLAssertionFactory method createSubjectConfirmation.
/**
* <p>
* Creates a {@code SubjectConfirmationType} object with the specified values.
* </p>
*
* @param nameID the identifier of the confirmation.
* @param confirmationMethod a {@code String} representing the confirmation method.
* @param keyInfoData the {@code KeyInfoConfirmationDataType} instance that contains the proof of possession key.
*
* @return the constructed {@code SubjectConfirmationType} instance.
*/
public static SubjectConfirmationType createSubjectConfirmation(NameIDType nameID, String confirmationMethod, KeyInfoConfirmationDataType keyInfoData) {
SubjectConfirmationType subjectConfirmation = new SubjectConfirmationType();
subjectConfirmation.setNameID(nameID);
subjectConfirmation.setMethod(confirmationMethod);
subjectConfirmation.setSubjectConfirmationData(keyInfoData);
return subjectConfirmation;
}
Aggregations