Skip to content
Snippets Groups Projects
Select Git revision
  • 33c6d6e7f9de46e7a49b497947ff2159e7d39c03
  • master default protected
  • 6
  • 6.1
  • 6.1.7
  • 6.1.6
  • 6.1.5
  • 6.1.4
  • 6.1.3
  • 6.1.2
  • 6.1.1
  • 6.1.0
  • 6.0
  • 6.0.0
  • 5.14
  • 5.14.1
  • 5.14.0
  • 5.13
  • 5.13.3
  • 5.13.2
  • 5.13.1
  • 5.13.0
22 results

gitlab-ci-docker.yml

Blame
  • JWTSecurityConfig.java 1.26 KiB
    /*
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */
    package com.tecnalia.datausage.config;
    
    import org.springframework.beans.factory.annotation.Value;
    import org.springframework.context.annotation.Configuration;
    import org.springframework.security.config.annotation.web.builders.HttpSecurity;
    import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
    import org.springframework.security.config.http.SessionCreationPolicy;
    
    /**
     *
     * @author root
     */
    @Configuration
    public class JWTSecurityConfig extends WebSecurityConfigurerAdapter {
    
    	@Value("${spring.profiles.active:Unknown}")
    	private String activeProfile;
    
    	@Override
    	public void configure(HttpSecurity http) throws Exception {
    		http.cors().and().csrf().disable().formLogin().disable().headers().httpStrictTransportSecurity().disable().and()
    				.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.ALWAYS).and()
    				.authorizeRequests(authz -> authz.antMatchers("/swagger-ui.html", "/swagger-ui/**","/v3/api-docs/**","/platoontec/**")
    						.permitAll().anyRequest().authenticated())
    				.oauth2ResourceServer(oauth2 -> oauth2.jwt());
    	}}