* build the authentication statement
* @param data
* @return
*/
private AuthnStatement createAuthnStatement(RahasData data) {
XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
MessageContext inMsgCtx = data.getInMessageContext();
SAMLObjectBuilder<AuthnStatement> authStmtBuilder =
(SAMLObjectBuilder<AuthnStatement>) builderFactory.getBuilder(AuthnStatement.DEFAULT_ELEMENT_NAME);
//build the auth stmt
AuthnStatement authStmt = authStmtBuilder.buildObject();
// set the authn instance
authStmt.setAuthnInstant(new DateTime());
SAMLObjectBuilder<AuthnContext> authCtxBuilder =
(SAMLObjectBuilder<AuthnContext>) builderFactory.getBuilder(AuthnContext.DEFAULT_ELEMENT_NAME);
AuthnContext authContext = authCtxBuilder.buildObject();
SAMLObjectBuilder<AuthnContextClassRef> authCtxClassRefBuilder =
(SAMLObjectBuilder<AuthnContextClassRef>) builderFactory.getBuilder(AuthnContextClassRef.DEFAULT_ELEMENT_NAME);
AuthnContextClassRef authCtxClassRef = authCtxClassRefBuilder.buildObject();
//if username/password based authn
if (inMsgCtx.getProperty(RahasConstants.USERNAME) != null) {
authCtxClassRef.setAuthnContextClassRef(AuthnContext.PASSWORD_AUTHN_CTX);