/** * Information from the IDP SSO Descriptor * * @param idp * @return */ public static String toString(IDPSSODescriptorType idp) { StringBuilder builder = new StringBuilder(); builder.append(LINE_SEPARATOR); // Get the SSODescriptor tags SSODescriptorType sdt = idp; builder.append(toString(sdt)); List<EndpointType> ssoServices = idp.getSingleSignOnService(); if (ssoServices != null) { builder.append("Single Sign On Services are:["); for (EndpointType edt : ssoServices) { builder.append(toString(edt)); } builder.append("]"); builder.append(LINE_SEPARATOR); } return builder.toString(); }
/** * Given a binding uri, get the IDP identity url * * @param idp * @param bindingURI * * @return */ public static String getLogoutURL(IDPSSODescriptorType idp, String bindingURI) { String logoutURL = null; List<EndpointType> endpoints = idp.getSingleLogoutService(); for (EndpointType endpoint : endpoints) { if (endpoint.getBinding().toString().equals(bindingURI)) { logoutURL = endpoint.getLocation().toString(); break; } } return logoutURL; }
/** * Create a IDP SSO metadata descriptor * * @param requestsSigned * @param keyDescriptorType * @param ssoEndPoint * @param sloEndPoint * @param attributes * @param org * @return */ public static IDPSSODescriptorType createIDPSSODescriptor(boolean requestsSigned, KeyDescriptorType keyDescriptorType, EndpointType ssoEndPoint, EndpointType sloEndPoint, List<AttributeType> attributes, OrganizationType org) { List<String> emptyList = new ArrayList<String>(); IDPSSODescriptorType idp = new IDPSSODescriptorType(emptyList); idp.addSingleSignOnService(ssoEndPoint); idp.addSingleLogoutService(sloEndPoint); for (AttributeType attr : attributes) { idp.addAttribute(attr); } idp.addKeyDescriptor(keyDescriptorType); idp.setWantAuthnRequestsSigned(requestsSigned); idp.setOrganization(org); return idp; }
IDPSSODescriptorType idpSSODescriptor = new IDPSSODescriptorType(protocolEnum); if (wantAuthnSigned != null) { idpSSODescriptor .setWantAuthnRequestsSigned(Boolean.parseBoolean(StaxParserUtil.getAttributeValue(wantAuthnSigned))); idpSSODescriptor.addArtifactResolutionService(endpoint); } else if (JBossSAMLConstants.ASSERTION_ID_REQUEST_SERVICE.get().equals(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); idpSSODescriptor.addAssertionIDRequestService(endpoint); } else if (JBossSAMLConstants.SINGLE_LOGOUT_SERVICE.get().equals(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); idpSSODescriptor.addSingleLogoutService(endpoint); } else if (JBossSAMLConstants.SINGLE_SIGNON_SERVICE.get().equals(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); idpSSODescriptor.addSingleSignOnService(endpoint); } else if (JBossSAMLConstants.MANAGE_NAMEID_SERVICE.get().equals(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); idpSSODescriptor.addManageNameIDService(endpoint); } else if (JBossSAMLConstants.NAMEID_MAPPING_SERVICE.get().equals(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); idpSSODescriptor.addNameIDMappingService(endpoint); } else if (JBossSAMLConstants.NAMEID_FORMAT.get().equalsIgnoreCase(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
METADATA_NSURI.get()); Boolean wantsAuthnRequestsSigned = idpSSODescriptor.isWantAuthnRequestsSigned(); if (wantsAuthnRequestsSigned != null) wantsAuthnRequestsSigned.toString()); writeProtocolSupportEnumeration(idpSSODescriptor.getProtocolSupportEnumeration()); List<IndexedEndpointType> artifactResolutionServices = idpSSODescriptor.getArtifactResolutionService(); for (IndexedEndpointType indexedEndpoint : artifactResolutionServices) List<EndpointType> sloServices = idpSSODescriptor.getSingleLogoutService(); for (EndpointType endpoint : sloServices) List<EndpointType> ssoServices = idpSSODescriptor.getSingleSignOnService(); for (EndpointType endpoint : ssoServices) List<String> nameIDFormats = idpSSODescriptor.getNameIDFormat(); for (String nameIDFormat : nameIDFormats) List<AttributeType> attributes = idpSSODescriptor.getAttribute(); for (AttributeType attribType : attributes)
wantAuthnRequestsSigned = IDPSSODescriptor.isWantAuthnRequestsSigned(); .getSingleSignOnService())); services.put(SamlProfile.SINGLE_LOGOUT, new SamlService(SamlProfile.SINGLE_LOGOUT, IDPSSODescriptor .getSingleLogoutService())); for (KeyDescriptorType keyDescriptor : IDPSSODescriptor.getKeyDescriptor())
private void processIdPMetadata(SPType spConfiguration) { IDPSSODescriptorType idpssoDescriptorType = null; if (isNotNull(spConfiguration.getIdpMetadataFile())) { idpssoDescriptorType = getIdpMetadataFromFile(spConfiguration); } else { idpssoDescriptorType = getIdpMetadataFromProvider(spConfiguration); } if (idpssoDescriptorType != null) { List<EndpointType> endpoints = idpssoDescriptorType.getSingleSignOnService(); for (EndpointType endpoint : endpoints) { String endpointBinding = endpoint.getBinding().toString(); if (endpointBinding.contains("HTTP-POST")) { endpointBinding = "POST"; } else if (endpointBinding.contains("HTTP-Redirect")) { endpointBinding = "REDIRECT"; } if (spConfiguration.getBindingType().equals(endpointBinding)) { spConfiguration.setIdentityURL(endpoint.getLocation().toString()); break; } } List<KeyDescriptorType> keyDescriptors = idpssoDescriptorType.getKeyDescriptor(); if (keyDescriptors.size() > 0) { this.idpCertificate = MetaDataExtractor.getCertificate(keyDescriptors.get(0)); } this.idpMetadata = idpssoDescriptorType; } }
private void updateKeyDescriptor(EntityDescriptorType entityD, KeyDescriptorType keyD) { List<EDTDescriptorChoiceType> objs = entityD.getChoiceType().get(0).getDescriptors(); if (objs != null) { for (EDTDescriptorChoiceType choiceTypeDesc : objs) { AttributeAuthorityDescriptorType attribDescriptor = choiceTypeDesc.getAttribDescriptor(); if (attribDescriptor != null) attribDescriptor.addKeyDescriptor(keyD); AuthnAuthorityDescriptorType authnDescriptor = choiceTypeDesc.getAuthnDescriptor(); if (authnDescriptor != null) authnDescriptor.addKeyDescriptor(keyD); IDPSSODescriptorType idpDescriptor = choiceTypeDesc.getIdpDescriptor(); if (idpDescriptor != null) idpDescriptor.addKeyDescriptor(keyD); PDPDescriptorType pdpDescriptor = choiceTypeDesc.getPdpDescriptor(); if (pdpDescriptor != null) pdpDescriptor.addKeyDescriptor(keyD); RoleDescriptorType roleDescriptor = choiceTypeDesc.getRoleDescriptor(); if (roleDescriptor != null) roleDescriptor.addKeyDescriptor(keyD); SPSSODescriptorType spDescriptorType = choiceTypeDesc.getSpDescriptor(); if (spDescriptorType != null) spDescriptorType.addKeyDescriptor(keyD); } } } }
IDPSSODescriptorType idpSSODescriptor = new IDPSSODescriptorType(protocolEnum); if (wantAuthnSigned != null) { idpSSODescriptor .setWantAuthnRequestsSigned(Boolean.parseBoolean(StaxParserUtil.getAttributeValue(wantAuthnSigned))); idpSSODescriptor.addArtifactResolutionService(endpoint); } else if (JBossSAMLConstants.ASSERTION_ID_REQUEST_SERVICE.get().equals(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); idpSSODescriptor.addAssertionIDRequestService(endpoint); } else if (JBossSAMLConstants.SINGLE_LOGOUT_SERVICE.get().equals(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); idpSSODescriptor.addSingleLogoutService(endpoint); } else if (JBossSAMLConstants.SINGLE_SIGNON_SERVICE.get().equals(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); idpSSODescriptor.addSingleSignOnService(endpoint); } else if (JBossSAMLConstants.MANAGE_NAMEID_SERVICE.get().equals(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); idpSSODescriptor.addManageNameIDService(endpoint); } else if (JBossSAMLConstants.NAMEID_MAPPING_SERVICE.get().equals(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); idpSSODescriptor.addNameIDMappingService(endpoint); } else if (JBossSAMLConstants.NAMEID_FORMAT.get().equalsIgnoreCase(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
Boolean wantsAuthnRequestsSigned = idpSSODescriptor.isWantAuthnRequestsSigned(); if (wantsAuthnRequestsSigned != null) { StaxUtil.writeAttribute(writer, new QName(JBossSAMLConstants.WANT_AUTHN_REQUESTS_SIGNED.get()), wantsAuthnRequestsSigned.toString()); writeProtocolSupportEnumeration(idpSSODescriptor.getProtocolSupportEnumeration()); List<IndexedEndpointType> artifactResolutionServices = idpSSODescriptor.getArtifactResolutionService(); for (IndexedEndpointType indexedEndpoint : artifactResolutionServices) { writeArtifactResolutionService(indexedEndpoint); List<EndpointType> sloServices = idpSSODescriptor.getSingleLogoutService(); for (EndpointType endpoint : sloServices) { writeSingleLogoutService(endpoint); List<EndpointType> ssoServices = idpSSODescriptor.getSingleSignOnService(); for (EndpointType endpoint : ssoServices) { writeSingleSignOnService(endpoint); List<String> nameIDFormats = idpSSODescriptor.getNameIDFormat(); for (String nameIDFormat : nameIDFormats) { writeNameIDFormat(nameIDFormat); List<AttributeType> attributes = idpSSODescriptor.getAttribute(); for (AttributeType attribType : attributes) { write(attribType);
private void processIdPMetadata(SPType spConfiguration) { IDPSSODescriptorType idpssoDescriptorType = null; if (isNotNull(spConfiguration.getIdpMetadataFile())) { idpssoDescriptorType = getIdpMetadataFromFile(spConfiguration); } else { idpssoDescriptorType = getIdpMetadataFromProvider(spConfiguration); } if (idpssoDescriptorType != null) { List<EndpointType> endpoints = idpssoDescriptorType.getSingleSignOnService(); for (EndpointType endpoint : endpoints) { String endpointBinding = endpoint.getBinding().toString(); if (endpointBinding.contains("HTTP-POST")) { endpointBinding = "POST"; } else if (endpointBinding.contains("HTTP-Redirect")) { endpointBinding = "REDIRECT"; } if (spConfiguration.getBindingType().equals(endpointBinding)) { spConfiguration.setIdentityURL(endpoint.getLocation().toString()); break; } } List<KeyDescriptorType> keyDescriptors = idpssoDescriptorType.getKeyDescriptor(); if (keyDescriptors.size() > 0) { this.idpCertificate = MetaDataExtractor.getCertificate(keyDescriptors.get(0)); } this.idpMetadata = idpssoDescriptorType; } }
private void updateKeyDescriptor(EntityDescriptorType entityD, KeyDescriptorType keyD) { List<EDTDescriptorChoiceType> objs = entityD.getChoiceType().get(0).getDescriptors(); if (objs != null) { for (EDTDescriptorChoiceType choiceTypeDesc : objs) { AttributeAuthorityDescriptorType attribDescriptor = choiceTypeDesc.getAttribDescriptor(); if (attribDescriptor != null) attribDescriptor.addKeyDescriptor(keyD); AuthnAuthorityDescriptorType authnDescriptor = choiceTypeDesc.getAuthnDescriptor(); if (authnDescriptor != null) authnDescriptor.addKeyDescriptor(keyD); IDPSSODescriptorType idpDescriptor = choiceTypeDesc.getIdpDescriptor(); if (idpDescriptor != null) idpDescriptor.addKeyDescriptor(keyD); PDPDescriptorType pdpDescriptor = choiceTypeDesc.getPdpDescriptor(); if (pdpDescriptor != null) pdpDescriptor.addKeyDescriptor(keyD); RoleDescriptorType roleDescriptor = choiceTypeDesc.getRoleDescriptor(); if (roleDescriptor != null) roleDescriptor.addKeyDescriptor(keyD); SPSSODescriptorType spDescriptorType = choiceTypeDesc.getSpDescriptor(); if (spDescriptorType != null) spDescriptorType.addKeyDescriptor(keyD); } } } }
IDPSSODescriptorType idpSSODescriptor = new IDPSSODescriptorType(protocolEnum); if (wantAuthnSigned != null) { idpSSODescriptor .setWantAuthnRequestsSigned(Boolean.parseBoolean(StaxParserUtil.getAttributeValue(wantAuthnSigned))); idpSSODescriptor.addArtifactResolutionService(endpoint); } else if (JBossSAMLConstants.ASSERTION_ID_REQUEST_SERVICE.get().equals(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); idpSSODescriptor.addAssertionIDRequestService(endpoint); } else if (JBossSAMLConstants.SINGLE_LOGOUT_SERVICE.get().equals(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); idpSSODescriptor.addSingleLogoutService(endpoint); } else if (JBossSAMLConstants.SINGLE_SIGNON_SERVICE.get().equals(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); idpSSODescriptor.addSingleSignOnService(endpoint); } else if (JBossSAMLConstants.MANAGE_NAMEID_SERVICE.get().equals(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); idpSSODescriptor.addManageNameIDService(endpoint); } else if (JBossSAMLConstants.NAMEID_MAPPING_SERVICE.get().equals(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); idpSSODescriptor.addNameIDMappingService(endpoint); } else if (JBossSAMLConstants.NAMEID_FORMAT.get().equalsIgnoreCase(localPart)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
Boolean wantsAuthnRequestsSigned = idpSSODescriptor.isWantAuthnRequestsSigned(); if (wantsAuthnRequestsSigned != null) { StaxUtil.writeAttribute(writer, new QName(JBossSAMLConstants.WANT_AUTHN_REQUESTS_SIGNED.get()), wantsAuthnRequestsSigned.toString()); writeProtocolSupportEnumeration(idpSSODescriptor.getProtocolSupportEnumeration()); List<IndexedEndpointType> artifactResolutionServices = idpSSODescriptor.getArtifactResolutionService(); for (IndexedEndpointType indexedEndpoint : artifactResolutionServices) { writeArtifactResolutionService(indexedEndpoint); List<EndpointType> sloServices = idpSSODescriptor.getSingleLogoutService(); for (EndpointType endpoint : sloServices) { writeSingleLogoutService(endpoint); List<EndpointType> ssoServices = idpSSODescriptor.getSingleSignOnService(); for (EndpointType endpoint : ssoServices) { writeSingleSignOnService(endpoint); List<String> nameIDFormats = idpSSODescriptor.getNameIDFormat(); for (String nameIDFormat : nameIDFormats) { writeNameIDFormat(nameIDFormat); List<AttributeType> attributes = idpSSODescriptor.getAttribute(); for (AttributeType attribType : attributes) { write(attribType);
/** * Create a IDP SSO metadata descriptor * * @param requestsSigned * @param keyDescriptorType * @param ssoEndPoint * @param sloEndPoint * @param attributes * @param org * * @return */ public static IDPSSODescriptorType createIDPSSODescriptor(boolean requestsSigned, KeyDescriptorType keyDescriptorType, EndpointType ssoEndPoint, EndpointType sloEndPoint, List<AttributeType> attributes, OrganizationType org) { List<String> emptyList = new ArrayList<String>(); IDPSSODescriptorType idp = new IDPSSODescriptorType(emptyList); idp.addSingleSignOnService(ssoEndPoint); idp.addSingleLogoutService(sloEndPoint); for (AttributeType attr : attributes) { idp.addAttribute(attr); } idp.addKeyDescriptor(keyDescriptorType); idp.setWantAuthnRequestsSigned(requestsSigned); idp.setOrganization(org); return idp; }
/** * Information from the IDP SSO Descriptor * @param idp * @return */ public static String toString(IDPSSODescriptorType idp) { StringBuilder builder = new StringBuilder(); builder.append(LINE_SEPARATOR); //Get the SSODescriptor tags SSODescriptorType sdt = idp; builder.append(toString(sdt)); List<EndpointType> ssoServices = idp.getSingleSignOnService(); if(ssoServices != null) { builder.append("Single Sign On Services are:["); for(EndpointType edt: ssoServices) { builder.append(toString(edt)); } builder.append("]"); builder.append(LINE_SEPARATOR); } return builder.toString(); }
private void processIdPMetadata(SPType spConfiguration) { IDPSSODescriptorType idpssoDescriptorType = null; if (isNotNull(spConfiguration.getIdpMetadataFile())) { idpssoDescriptorType = getIdpMetadataFromFile(spConfiguration); } else { idpssoDescriptorType = getIdpMetadataFromProvider(spConfiguration); } if (idpssoDescriptorType != null) { List<EndpointType> endpoints = idpssoDescriptorType.getSingleSignOnService(); for (EndpointType endpoint : endpoints) { String endpointBinding = endpoint.getBinding().toString(); if (endpointBinding.contains("HTTP-POST")) { endpointBinding = "POST"; } else if (endpointBinding.contains("HTTP-Redirect")) { endpointBinding = "REDIRECT"; } if (spConfiguration.getBindingType().equals(endpointBinding)) { spConfiguration.setIdentityURL(endpoint.getLocation().toString()); break; } } List<KeyDescriptorType> keyDescriptors = idpssoDescriptorType.getKeyDescriptor(); if (keyDescriptors.size() > 0) { this.idpCertificate = MetaDataExtractor.getCertificate(keyDescriptors.get(0)); } this.idpMetadata = idpssoDescriptorType; } }
/** * Given a binding uri, get the IDP logout url * * @param idp * @param bindingURI * @return */ public static String getLogoutURL(IDPSSODescriptorType idp, String bindingURI) { String logoutURL = null; List<EndpointType> endpoints = idp.getSingleLogoutService(); for (EndpointType endpoint : endpoints) { if (endpoint.getBinding().toString().equals(bindingURI)) { logoutURL = endpoint.getLocation().toString(); break; } } return logoutURL; }
IDPSSODescriptorType idpSSODescriptor = new IDPSSODescriptorType(protocolEnum); if (wantAuthnSigned != null) idpSSODescriptor.setWantAuthnRequestsSigned(Boolean.parseBoolean(StaxParserUtil .getAttributeValue(wantAuthnSigned))); idpSSODescriptor.addArtifactResolutionService(endpoint); StaxParserUtil.validate(endElement, JBossSAMLConstants.ASSERTION_ID_REQUEST_SERVICE.get()); idpSSODescriptor.addAssertionIDRequestService(endpoint); idpSSODescriptor.addSingleLogoutService(endpoint); idpSSODescriptor.addSingleSignOnService(endpoint); idpSSODescriptor.addManageNameIDService(endpoint); idpSSODescriptor.addNameIDMappingService(endpoint); idpSSODescriptor.addNameIDFormat(StaxParserUtil.getElementText(xmlEventReader)); idpSSODescriptor.addAttribute(attribute); idpSSODescriptor.addKeyDescriptor(keyDescriptor); idpSSODescriptor.setExtensions(parseExtensions(xmlEventReader));
Boolean wantsAuthnRequestsSigned = idpSSODescriptor.isWantAuthnRequestsSigned(); if (wantsAuthnRequestsSigned != null) { StaxUtil.writeAttribute(writer, new QName(JBossSAMLConstants.WANT_AUTHN_REQUESTS_SIGNED.get()), wantsAuthnRequestsSigned.toString()); writeProtocolSupportEnumeration(idpSSODescriptor.getProtocolSupportEnumeration()); List<IndexedEndpointType> artifactResolutionServices = idpSSODescriptor.getArtifactResolutionService(); for (IndexedEndpointType indexedEndpoint : artifactResolutionServices) { writeArtifactResolutionService(indexedEndpoint); List<EndpointType> sloServices = idpSSODescriptor.getSingleLogoutService(); for (EndpointType endpoint : sloServices) { writeSingleLogoutService(endpoint); List<EndpointType> ssoServices = idpSSODescriptor.getSingleSignOnService(); for (EndpointType endpoint : ssoServices) { writeSingleSignOnService(endpoint); List<String> nameIDFormats = idpSSODescriptor.getNameIDFormat(); for (String nameIDFormat : nameIDFormats) { writeNameIDFormat(nameIDFormat); List<AttributeType> attributes = idpSSODescriptor.getAttribute(); for (AttributeType attribType : attributes) { write(attribType);