SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(PicketLinkCoreSTS.rte);
SAML11ProtocolContext samlProtocolContext = (SAML11ProtocolContext) context;
String issuerID = samlProtocolContext.getIssuerID();
if (issuerID == null)
throw logger.nullArgumentError("Issuer in SAML Protocol Context");
XMLGregorianCalendar issueInstant;
try {
issueInstant = XMLTimeUtil.getIssueInstant();
} catch (ConfigurationException e) {
throw new ProcessingException(e);
}
SAML11SubjectType subject = samlProtocolContext.getSubjectType();
List<SAML11StatementAbstractType> statements = samlProtocolContext.getStatements();
// generate an id for the new assertion.
String assertionID = IDGenerator.create("ID_");
SAML11AssertionType assertionType = new SAML11AssertionType(assertionID, issueInstant);
assertionType.setIssuer(issuerID);
assertionType.addAllStatements(statements);
try {
AssertionUtil.createSAML11TimedConditions(assertionType, ASSERTION_VALIDITY, CLOCK_SKEW);
} catch (Exception e) {
throw logger.processingError(e);
}
// Create authentication statement
URI authenticationMethod = URI.create(samlProtocolContext.getAuthMethod());
SAML11AuthenticationStatementType stat = new SAML11AuthenticationStatementType(authenticationMethod, issueInstant);
stat.setSubject(subject);
assertionType.add(stat);
try {
this.tokenRegistry.addToken(assertionID, assertionType);
} catch (IOException e) {
throw logger.processingError(e);
}
samlProtocolContext.setIssuedAssertion(assertionType);
}