/** * Get the NameIDPolicy * * @param startElement * @return */ private NameIDPolicyType getNameIDPolicy(StartElement startElement) { NameIDPolicyType nameIDPolicy = new NameIDPolicyType(); Attribute format = startElement.getAttributeByName(new QName(JBossSAMLConstants.FORMAT.get())); if (format != null) nameIDPolicy.setFormat(URI.create(StaxParserUtil.getAttributeValue(format))); Attribute allowCreate = startElement.getAttributeByName(new QName(JBossSAMLConstants.ALLOW_CREATE.get())); if (allowCreate != null) nameIDPolicy.setAllowCreate(Boolean.parseBoolean(StaxParserUtil.getAttributeValue(allowCreate))); return nameIDPolicy; }
/** * Write a {@code NameIDPolicyType} to stream * * @param nameIDPolicy * * @throws ProcessingException */ public void write(NameIDPolicyType nameIDPolicy) throws ProcessingException { StaxUtil.writeStartElement(writer, PROTOCOL_PREFIX, JBossSAMLConstants.NAMEID_POLICY.get(), PROTOCOL_NSURI.get()); URI format = nameIDPolicy.getFormat(); if (format != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.FORMAT.get(), format.toASCIIString()); } String spNameQualifier = nameIDPolicy.getSPNameQualifier(); if (StringUtil.isNotNull(spNameQualifier)) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.SP_NAME_QUALIFIER.get(), spNameQualifier); } Boolean allowCreate = nameIDPolicy.isAllowCreate(); if (allowCreate != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.ALLOW_CREATE.get(), allowCreate.toString()); } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
/** * Write a {@code NameIDPolicyType} to stream * * @param nameIDPolicy * @throws ProcessingException */ public void write(NameIDPolicyType nameIDPolicy) throws ProcessingException { StaxUtil.writeStartElement(writer, PROTOCOL_PREFIX, JBossSAMLConstants.NAMEID_POLICY.get(), PROTOCOL_NSURI.get()); URI format = nameIDPolicy.getFormat(); if (format != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.FORMAT.get(), format.toASCIIString()); } String spNameQualifier = nameIDPolicy.getSPNameQualifier(); if (StringUtil.isNotNull(spNameQualifier)) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.SP_NAME_QUALIFIER.get(), spNameQualifier); } Boolean allowCreate = nameIDPolicy.isAllowCreate(); if (allowCreate != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.ALLOW_CREATE.get(), allowCreate.toString()); } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
/** * Get the NameIDPolicy * @param startElement * @return */ private NameIDPolicyType getNameIDPolicy(StartElement startElement) { NameIDPolicyType nameIDPolicy = new NameIDPolicyType(); Attribute format = startElement.getAttributeByName(new QName(JBossSAMLConstants.FORMAT.get())); if (format != null) nameIDPolicy.setFormat(URI.create(StaxParserUtil.getAttributeValue(format))); Attribute allowCreate = startElement.getAttributeByName(new QName(JBossSAMLConstants.ALLOW_CREATE.get())); if (allowCreate != null) nameIDPolicy.setAllowCreate(Boolean.parseBoolean(StaxParserUtil.getAttributeValue(allowCreate))); return nameIDPolicy; }
/** * Write a {@code NameIDPolicyType} to stream * * @param nameIDPolicy * * @throws ProcessingException */ public void write(NameIDPolicyType nameIDPolicy) throws ProcessingException { StaxUtil.writeStartElement(writer, PROTOCOL_PREFIX, JBossSAMLConstants.NAMEID_POLICY.get(), PROTOCOL_NSURI.get()); URI format = nameIDPolicy.getFormat(); if (format != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.FORMAT.get(), format.toASCIIString()); } String spNameQualifier = nameIDPolicy.getSPNameQualifier(); if (StringUtil.isNotNull(spNameQualifier)) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.SP_NAME_QUALIFIER.get(), spNameQualifier); } Boolean allowCreate = nameIDPolicy.isAllowCreate(); if (allowCreate != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.ALLOW_CREATE.get(), allowCreate.toString()); } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
/** * Get the NameIDPolicy * @param startElement * @return */ private NameIDPolicyType getNameIDPolicy(StartElement startElement) { NameIDPolicyType nameIDPolicy = new NameIDPolicyType(); Attribute format = startElement.getAttributeByName(new QName(JBossSAMLConstants.FORMAT.get())); if (format != null) nameIDPolicy.setFormat(URI.create(StaxParserUtil.getAttributeValue(format))); Attribute allowCreate = startElement.getAttributeByName(new QName(JBossSAMLConstants.ALLOW_CREATE.get())); if (allowCreate != null) nameIDPolicy.setAllowCreate(Boolean.parseBoolean(StaxParserUtil.getAttributeValue(allowCreate))); return nameIDPolicy; }
/** * Write a {@code NameIDPolicyType} to stream * @param nameIDPolicy * @param out * @throws ProcessingException */ public void write(NameIDPolicyType nameIDPolicy) throws ProcessingException { StaxUtil.writeStartElement(writer, PROTOCOL_PREFIX, JBossSAMLConstants.NAMEID_POLICY.get(), PROTOCOL_NSURI.get()); URI format = nameIDPolicy.getFormat(); if (format != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.FORMAT.get(), format.toASCIIString()); } String spNameQualifier = nameIDPolicy.getSPNameQualifier(); if (StringUtil.isNotNull(spNameQualifier)) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.SP_NAME_QUALIFIER.get(), spNameQualifier); } Boolean allowCreate = nameIDPolicy.isAllowCreate(); if (allowCreate != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.ALLOW_CREATE.get(), allowCreate.toString()); } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
/** * Get the NameIDPolicy * * @param startElement * * @return */ private NameIDPolicyType getNameIDPolicy(StartElement startElement) { NameIDPolicyType nameIDPolicy = new NameIDPolicyType(); Attribute format = startElement.getAttributeByName(new QName(JBossSAMLConstants.FORMAT.get())); if (format != null) nameIDPolicy.setFormat(URI.create(StaxParserUtil.getAttributeValue(format))); Attribute allowCreate = startElement.getAttributeByName(new QName(JBossSAMLConstants.ALLOW_CREATE.get())); if (allowCreate != null) nameIDPolicy.setAllowCreate(Boolean.parseBoolean(StaxParserUtil.getAttributeValue(allowCreate))); return nameIDPolicy; }
/** * Write a {@code NameIDPolicyType} to stream * @param nameIDPolicy * @param out * @throws ProcessingException */ public void write(NameIDPolicyType nameIDPolicy) throws ProcessingException { StaxUtil.writeStartElement(writer, PROTOCOL_PREFIX, JBossSAMLConstants.NAMEID_POLICY.get(), PROTOCOL_NSURI.get()); URI format = nameIDPolicy.getFormat(); if (format != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.FORMAT.get(), format.toASCIIString()); } String spNameQualifier = nameIDPolicy.getSPNameQualifier(); if (StringUtil.isNotNull(spNameQualifier)) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.SP_NAME_QUALIFIER.get(), spNameQualifier); } Boolean allowCreate = nameIDPolicy.isAllowCreate(); if (allowCreate != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.ALLOW_CREATE.get(), allowCreate.toString()); } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
/** * Get the NameIDPolicy * * @param startElement * * @return */ private NameIDPolicyType getNameIDPolicy(StartElement startElement) { NameIDPolicyType nameIDPolicy = new NameIDPolicyType(); Attribute format = startElement.getAttributeByName(new QName(JBossSAMLConstants.FORMAT.get())); if (format != null) nameIDPolicy.setFormat(URI.create(StaxParserUtil.getAttributeValue(format))); Attribute allowCreate = startElement.getAttributeByName(new QName(JBossSAMLConstants.ALLOW_CREATE.get())); if (allowCreate != null) nameIDPolicy.setAllowCreate(Boolean.parseBoolean(StaxParserUtil.getAttributeValue(allowCreate))); return nameIDPolicy; }
/** * Create an authentication request * * @param id * @param assertionConsumerURL * @param destination * @param issuerValue * @return * @throws ConfigurationException */ public AuthnRequestType createAuthnRequestType(String id, String assertionConsumerURL, String destination, String issuerValue) throws ConfigurationException { XMLGregorianCalendar issueInstant = XMLTimeUtil.getIssueInstant(); AuthnRequestType authnRequest = new AuthnRequestType(id, issueInstant); authnRequest.setAssertionConsumerServiceURL(URI.create(assertionConsumerURL)); authnRequest.setProtocolBinding(URI.create(JBossSAMLConstants.HTTP_POST_BINDING.get())); if (destination != null) { authnRequest.setDestination(URI.create(destination)); } // Create an issuer NameIDType issuer = new NameIDType(); issuer.setValue(issuerValue); authnRequest.setIssuer(issuer); // Create a default NameIDPolicy NameIDPolicyType nameIDPolicy = new NameIDPolicyType(); nameIDPolicy.setAllowCreate(Boolean.TRUE); nameIDPolicy.setFormat(URI.create(this.nameIDFormat)); authnRequest.setNameIDPolicy(nameIDPolicy); return authnRequest; }
NameIDPolicyType nameIDPolicy = new NameIDPolicyType(); nameIDPolicy.setAllowCreate(Boolean.TRUE); nameIDPolicy.setFormat(URI.create(this.nameIDFormat));
NameIDPolicyType nameIDPolicy = new NameIDPolicyType(); nameIDPolicy.setAllowCreate(Boolean.TRUE); nameIDPolicy.setFormat(URI.create(this.nameIDFormat));
NameIDPolicyType nameIDPolicy = new NameIDPolicyType(); nameIDPolicy.setAllowCreate(Boolean.TRUE); nameIDPolicy.setFormat(URI.create(this.nameIDFormat));