All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fivefaces.structureclient.config.security.SecurityProperties Maven / Gradle / Ivy

There is a newer version: 1.0.62
Show newest version
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;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy