/** * Create an assertion * * @param id * @param issuer * @return */ public static SAML11AssertionType createSAML11Assertion(String id, XMLGregorianCalendar issueInstant, String issuer) { SAML11AssertionType assertion = new SAML11AssertionType(id, issueInstant); assertion.setIssuer(issuer); return assertion; }
/** * Given a set of roles, create an attribute statement * * @param roles * @return */ private SAML11AttributeStatementType createAttributeStatement(List<String> roles) { SAML11AttributeStatementType attrStatement = null; for (String role : roles) { if (attrStatement == null) { attrStatement = new SAML11AttributeStatementType(); } SAML11AttributeType attr = new SAML11AttributeType("Role", URI.create("urn:picketlink:role")); attr.add(role); attrStatement.add(attr); } return attrStatement; }
/** * Add validity conditions to the SAML2 Assertion * @param assertion * @param durationInMilis * @throws ConfigurationException * @throws IssueInstantMissingException */ public static void createSAML11TimedConditions(SAML11AssertionType assertion, long durationInMilis, long clockSkew) throws ConfigurationException, IssueInstantMissingException { XMLGregorianCalendar issueInstant = assertion.getIssueInstant(); if (issueInstant == null) throw new IssueInstantMissingException(ErrorCodes.NULL_ISSUE_INSTANT); XMLGregorianCalendar assertionValidityLength = XMLTimeUtil.add(issueInstant, durationInMilis + clockSkew); SAML11ConditionsType conditionsType = new SAML11ConditionsType(); XMLGregorianCalendar beforeInstant = XMLTimeUtil.subtract(issueInstant, clockSkew); conditionsType.setNotBefore(beforeInstant); conditionsType.setNotOnOrAfter(assertionValidityLength); assertion.setConditions(conditionsType); }
public void write(SAML11AuthorizationDecisionStatementType xacmlStat) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, SAML11Constants.AUTHORIZATION_DECISION_STATEMENT, ns); String resource = xacmlStat.getResource().toString(); StaxUtil.writeAttribute(writer, SAML11Constants.RESOURCE, resource); StaxUtil.writeAttribute(writer, SAML11Constants.DECISION, xacmlStat.getDecision().name()); SAML11SubjectType subject = xacmlStat.getSubject(); if (subject != null) write(subject); List<SAML11ActionType> actions = xacmlStat.getActions(); for (SAML11ActionType action : actions) { write(action); } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
public void write(SAML11AuthorityBindingType authority) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, SAML11Constants.AUTHORITY_BINDING, SAML11Constants.ASSERTION_11_NSURI); QName authorityKind = authority.getAuthorityKind(); StaxUtil.writeAttribute(writer, SAML11Constants.AUTHORITY_KIND, authorityKind); String binding = authority.getBinding().toString(); StaxUtil.writeAttribute(writer, SAML11Constants.BINDING, binding); String location = authority.getLocation().toString(); StaxUtil.writeAttribute(writer, SAML11Constants.LOCATION, location); StaxUtil.writeEndElement(writer); }
public void write(SAML11ActionType action) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, SAML11Constants.ACTION, ns); String ns = action.getNamespace(); if (StringUtil.isNotNull(ns)) { StaxUtil.writeAttribute(writer, SAML11Constants.NAMESPACE, ns); } String val = action.getValue(); if (StringUtil.isNotNull(val)) { StaxUtil.writeCharacters(writer, val); } StaxUtil.writeEndElement(writer); }
/** * Given a set of roles, create an attribute statement * * @param roles * @return */ private SAML11AttributeStatementType createAttributeStatement(List<String> roles) { SAML11AttributeStatementType attrStatement = null; for (String role : roles) { if (attrStatement == null) { attrStatement = new SAML11AttributeStatementType(); } SAML11AttributeType attr = new SAML11AttributeType("Role", URI.create("urn:picketlink:role")); //$NON-NLS-1$ //$NON-NLS-2$ attr.add(role); attrStatement.add(attr); } return attrStatement; }
public void write(SAML11AuthorizationDecisionStatementType xacmlStat) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, SAML11Constants.AUTHORIZATION_DECISION_STATEMENT, ns); String resource = xacmlStat.getResource().toString(); StaxUtil.writeAttribute(writer, SAML11Constants.RESOURCE, resource); StaxUtil.writeAttribute(writer, SAML11Constants.DECISION, xacmlStat.getDecision().name()); SAML11SubjectType subject = xacmlStat.getSubject(); if (subject != null) write(subject); List<SAML11ActionType> actions = xacmlStat.getActions(); for (SAML11ActionType action : actions) { write(action); } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
public void write(SAML11AuthorityBindingType authority) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, SAML11Constants.AUTHORITY_BINDING, SAML11Constants.ASSERTION_11_NSURI); QName authorityKind = authority.getAuthorityKind(); StaxUtil.writeAttribute(writer, SAML11Constants.AUTHORITY_KIND, authorityKind); String binding = authority.getBinding().toString(); StaxUtil.writeAttribute(writer, SAML11Constants.BINDING, binding); String location = authority.getLocation().toString(); StaxUtil.writeAttribute(writer, SAML11Constants.LOCATION, location); StaxUtil.writeEndElement(writer); }
/** * Create an assertion * @param id * @param issuer * @return */ public static SAML11AssertionType createSAML11Assertion(String id, XMLGregorianCalendar issueInstant, String issuer) { SAML11AssertionType assertion = new SAML11AssertionType(id, issueInstant); assertion.setIssuer(issuer); return assertion; }
public void write(SAML11ActionType action) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, SAML11Constants.ACTION, ns); String ns = action.getNamespace(); if (StringUtil.isNotNull(ns)) { StaxUtil.writeAttribute(writer, SAML11Constants.NAMESPACE, ns); } String val = action.getValue(); if (StringUtil.isNotNull(val)) { StaxUtil.writeCharacters(writer, val); } StaxUtil.writeEndElement(writer); }
/** * Given a set of roles, create an attribute statement * * @param roles * @return */ private SAML11AttributeStatementType createAttributeStatement(List<String> roles) { SAML11AttributeStatementType attrStatement = null; for (String role : roles) { if (attrStatement == null) { attrStatement = new SAML11AttributeStatementType(); } SAML11AttributeType attr = new SAML11AttributeType("Role", URI.create("urn:picketlink:role")); attr.add(role); attrStatement.add(attr); } return attrStatement; }
public void write(SAML11AuthorizationDecisionStatementType xacmlStat) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, SAML11Constants.AUTHORIZATION_DECISION_STATEMENT, ns); String resource = xacmlStat.getResource().toString(); StaxUtil.writeAttribute(writer, SAML11Constants.RESOURCE, resource); StaxUtil.writeAttribute(writer, SAML11Constants.DECISION, xacmlStat.getDecision().name()); SAML11SubjectType subject = xacmlStat.getSubject(); if (subject != null) write(subject); List<SAML11ActionType> actions = xacmlStat.getActions(); for (SAML11ActionType action : actions) { write(action); } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
public void write(SAML11AuthorityBindingType authority) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, SAML11Constants.AUTHORITY_BINDING, SAML11Constants.ASSERTION_11_NSURI); QName authorityKind = authority.getAuthorityKind(); StaxUtil.writeAttribute(writer, SAML11Constants.AUTHORITY_KIND, authorityKind); String binding = authority.getBinding().toString(); StaxUtil.writeAttribute(writer, SAML11Constants.BINDING, binding); String location = authority.getLocation().toString(); StaxUtil.writeAttribute(writer, SAML11Constants.LOCATION, location); StaxUtil.writeEndElement(writer); }
/** * Create an assertion * @param id * @param issuer * @return */ public static SAML11AssertionType createSAML11Assertion(String id, XMLGregorianCalendar issueInstant, String issuer) { SAML11AssertionType assertion = new SAML11AssertionType(id, issueInstant); assertion.setIssuer(issuer); return assertion; }
/** * Given a set of roles, create an attribute statement * * @param roles * * @return */ private SAML11AttributeStatementType createAttributeStatement(List<String> roles) { SAML11AttributeStatementType attrStatement = null; for (String role : roles) { if (attrStatement == null) { attrStatement = new SAML11AttributeStatementType(); } SAML11AttributeType attr = new SAML11AttributeType("Role", URI.create("urn:picketlink:role")); attr.add(role); attrStatement.add(attr); } return attrStatement; }
/** * Create an assertion * * @param id * @param issuer * * @return */ public static SAML11AssertionType createSAML11Assertion(String id, XMLGregorianCalendar issueInstant, String issuer) { SAML11AssertionType assertion = new SAML11AssertionType(id, issueInstant); assertion.setIssuer(issuer); return assertion; }
/** * Given a set of roles, create an attribute statement * * @param roles * * @return */ private SAML11AttributeStatementType createAttributeStatement(List<String> roles) { SAML11AttributeStatementType attrStatement = null; for (String role : roles) { if (attrStatement == null) { attrStatement = new SAML11AttributeStatementType(); } SAML11AttributeType attr = new SAML11AttributeType("Role", URI.create("urn:picketlink:role")); attr.add(role); attrStatement.add(attr); } return attrStatement; }
/** * Create an assertion * * @param id * @param issuer * * @return */ public static SAML11AssertionType createSAML11Assertion(String id, XMLGregorianCalendar issueInstant, String issuer) { SAML11AssertionType assertion = new SAML11AssertionType(id, issueInstant); assertion.setIssuer(issuer); return assertion; }
/** * Given a set of roles, create an attribute statement * * @param roles * * @return */ private SAML11AttributeStatementType createAttributeStatement(List<String> roles) { SAML11AttributeStatementType attrStatement = null; for (String role : roles) { if (attrStatement == null) { attrStatement = new SAML11AttributeStatementType(); } SAML11AttributeType attr = new SAML11AttributeType("Role", URI.create("urn:picketlink:role")); attr.add(role); attrStatement.add(attr); } return attrStatement; }