com.fivefaces.structureclient.config.security.SecurityProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common-structure-client Show documentation
Show all versions of common-structure-client Show documentation
structure Client for Five Faces
package com.fivefaces.structureclient.config.security;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.cors.CorsConfiguration;
import java.util.List;
@Getter
@Setter
@Component
@Configuration
@ConfigurationProperties(prefix = "rest.security")
public class SecurityProperties {
private String userIssuerUri;
private String userJwkSetUri;
private Cors cors;
public CorsConfiguration getCorsConfiguration() {
CorsConfiguration corsConfiguration = new CorsConfiguration();
corsConfiguration.setAllowedOrigins(cors.getAllowedOrigins());
corsConfiguration.setAllowedMethods(cors.getAllowedMethods());
corsConfiguration.setAllowedHeaders(cors.getAllowedHeaders());
corsConfiguration.setExposedHeaders(cors.getExposedHeaders());
corsConfiguration.setAllowCredentials(cors.getAllowCredentials());
corsConfiguration.setMaxAge(cors.getMaxAge());
return corsConfiguration;
}
@Getter
@Setter
public static class Cors {
private List allowedOrigins;
private List allowedMethods;
private List allowedHeaders;
private List exposedHeaders;
private Boolean allowCredentials;
private Long maxAge;
}
}