Merge pull request #11077 from rmkellogg/spring-saml-docs
Spring Security SAML - Minor documentation update & File Load Improvement
This commit is contained in:
commit
48bc32bad5
@ -5,10 +5,13 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Timer;
|
||||||
|
|
||||||
import org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider;
|
import org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider;
|
||||||
import org.opensaml.saml2.metadata.provider.MetadataProvider;
|
import org.opensaml.saml2.metadata.provider.MetadataProvider;
|
||||||
import org.opensaml.saml2.metadata.provider.MetadataProviderException;
|
import org.opensaml.saml2.metadata.provider.MetadataProviderException;
|
||||||
|
import org.opensaml.saml2.metadata.provider.ResourceBackedMetadataProvider;
|
||||||
|
import org.opensaml.util.resource.ClasspathResource;
|
||||||
import org.opensaml.util.resource.ResourceException;
|
import org.opensaml.util.resource.ResourceException;
|
||||||
import org.opensaml.xml.parse.StaticBasicParserPool;
|
import org.opensaml.xml.parse.StaticBasicParserPool;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
@ -141,13 +144,19 @@ public class SamlSecurityConfig {
|
|||||||
@Bean
|
@Bean
|
||||||
@Qualifier("okta")
|
@Qualifier("okta")
|
||||||
public ExtendedMetadataDelegate oktaExtendedMetadataProvider() throws MetadataProviderException {
|
public ExtendedMetadataDelegate oktaExtendedMetadataProvider() throws MetadataProviderException {
|
||||||
File metadata = null;
|
// Use the Spring Security SAML resource mechanism to load
|
||||||
try {
|
// metadata from the Java classpath. This works from Spring Boot
|
||||||
metadata = new File("./src/main/resources/saml/metadata/sso.xml");
|
// self contained JAR file.
|
||||||
} catch (Exception e) {
|
org.opensaml.util.resource.Resource resource = null;
|
||||||
e.printStackTrace();
|
|
||||||
}
|
try {
|
||||||
FilesystemMetadataProvider provider = new FilesystemMetadataProvider(metadata);
|
resource = new ClasspathResource("/saml/metadata/sso.xml");
|
||||||
|
} catch (ResourceException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer timer = new Timer("saml-metadata");
|
||||||
|
ResourceBackedMetadataProvider provider = new ResourceBackedMetadataProvider(timer,resource);
|
||||||
provider.setParserPool(parserPool());
|
provider.setParserPool(parserPool());
|
||||||
return new ExtendedMetadataDelegate(provider, extendedMetadata());
|
return new ExtendedMetadataDelegate(provider, extendedMetadata());
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
saml.keystore.location=classpath:/saml/samlKeystore.jks
|
saml.keystore.location=classpath:/saml/samlKeystore.jks
|
||||||
|
# Password for Java keystore and item therein
|
||||||
saml.keystore.password=<key_pass>
|
saml.keystore.password=<key_pass>
|
||||||
saml.keystore.alias=<key_alias>
|
saml.keystore.alias=<key_alias>
|
||||||
|
|
||||||
|
# SAML Entity ID extracted from top of SAML metadata file
|
||||||
saml.idp=<idp_issuer_url>
|
saml.idp=<idp_issuer_url>
|
||||||
saml.sp=http://localhost:8080/saml/metadata
|
saml.sp=http://localhost:8080/saml/metadata
|
Loading…
x
Reference in New Issue
Block a user