Skip to content

Commit

Permalink
wip: configure some metadata params
Browse files Browse the repository at this point in the history
Co-authored-by: Danny Faught <danny.faught@broadcom.com>
  • Loading branch information
peterhaochen47 and swalchemist committed Mar 26, 2024
1 parent 9acac27 commit 29a843f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.cloudfoundry.identity.uaa.provider.saml;

import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.security.saml2.provider.service.registration.InMemoryRelyingPartyRegistrationRepository;
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration;
Expand All @@ -20,10 +22,20 @@ public class SamlRelyingPartyRegistrationRepository {
// SP metadata generation. See relevant issue: https://github.com/spring-projects/spring-security/issues/11369
public static final String CLASSPATH_DUMMY_SAML_IDP_METADATA_XML = "classpath:dummy-saml-idp-metadata.xml";

@Autowired
@Qualifier("samlEntityID")
private String samlEntityID;

@Autowired
@Qualifier("samlSpNameID")
private String samlSpNameID;

@Bean
RelyingPartyRegistrationRepository relyingPartyRegistrationRepository() {
RelyingPartyRegistration relyingPartyRegistration = RelyingPartyRegistrations
.fromMetadataLocation(CLASSPATH_DUMMY_SAML_IDP_METADATA_XML)
.entityId(samlEntityID)
.nameIdFormat(samlSpNameID)
.registrationId("example")
.build();
return new InMemoryRelyingPartyRegistrationRepository(relyingPartyRegistration);
Expand Down
4 changes: 4 additions & 0 deletions uaa/src/main/webapp/WEB-INF/spring/saml-providers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
<b:constructor-arg value="${login.entityID:unit-test-sp}" />
</b:bean>

<b:bean id="samlSpNameID" class="java.lang.String">
<b:constructor-arg value="${login.saml.NameID:urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified}" />
</b:bean>

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

0 comments on commit 29a843f

Please sign in to comment.