org.eclipse.dirigible.components.security.oauth2.OAuth2SecurityConfiguration Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2024 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v2.0 which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* SPDX-FileCopyrightText: Eclipse Dirigible contributors SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.dirigible.components.security.oauth2;
import org.eclipse.dirigible.components.base.http.access.HttpSecurityURIConfigurator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.SecurityFilterChain;
/**
* The Class OAuth2SecurityConfiguration.
*/
@Profile("oauth")
@Configuration
public class OAuth2SecurityConfiguration {
/**
* Filter chain.
*
* @param http the http
* @return the security filter chain
* @throws Exception the exception
*/
@Bean
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.cors(Customizer.withDefaults())
.csrf(csrf -> csrf.disable())
.headers(headers -> headers.frameOptions(frameOpts -> frameOpts.disable()))
.oauth2Login(Customizer.withDefaults());
HttpSecurityURIConfigurator.configure(http);
return http.build();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy