Skip to content

SAML Metadata - incorrect SAML metadata is generated when entityID is a URL #3661

@fhanik

Description

@fhanik

in uaa.yml if we have

login:
  entityID: http://some.saml.com/entityID

Previous version generated SAML metadata:

<?xml version="1.0" encoding="UTF-8"?>
<md:EntityDescriptor 
    ID="http___some.saml.com_entityID" 
    entityID="http://some.saml.com/entityID" 
    xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata">
...
    <md:AssertionConsumerService 
        Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" 
        Location="http://localhost:8080/uaa/saml/SSO/alias/some.saml.com" 
        index="0" 
        isDefault="true"/>
    <md:AssertionConsumerService 
        Binding="urn:oasis:names:tc:SAML:2.0:bindings:URI" 
        Location="http://localhost:8080/uaa/oauth/token/alias/some.saml.com" 
        index="1"/>
...
</md:EntityDescriptor>

The 78.x release train generates the following (the AssertionConsumerService.Location attribute is incorrect)

<?xml version="1.0" encoding="UTF-8"?>
<md:EntityDescriptor 
    ID="http___some.saml.com_entityID"
    entityID="http://some.saml.com/entityID"
    xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata">
...
    <md:AssertionConsumerService 
        Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" 
        Location="http://localhost:8080/uaa/saml/SSO/alias/http:/some.saml.com/entityID"
        index="0" 
        isDefault="true"/>
    <md:AssertionConsumerService 
        Binding="urn:oasis:names:tc:SAML:2.0:bindings:URI" 
        Location="http://localhost:8080/uaa/saml/SSO/alias/http:/some.saml.com/entityID"
        index="1"/>
...
</md:EntityDescriptor>

and this must also work correctly for SAML metadata in a zone.

The old code used to do (in Spring XML - see getHostIfArgIsURL )

    <bean id="samlSPAlias" class="java.lang.String">
        <constructor-arg value="${login.saml.entityIDAlias:${login.entityID:unit-test-sp}}"/>
    </bean>

    <bean id="extendedMetaData" class="org.springframework.security.saml.metadata.ExtendedMetadata">
        <property name="idpDiscoveryEnabled" value="true"/>
        <property name="alias"
                  value="#{T(org.cloudfoundry.identity.uaa.util.UaaStringUtils).getHostIfArgIsURL(@samlSPAlias)}"/>
        <property name="signMetadata" value="${login.saml.signMetaData:true}"/>
    </bean>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions