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

com.codingapi.springboot.security.configurer.HttpSecurityConfigurer Maven / Gradle / Ivy

There is a newer version: 3.2.6
Show newest version
package com.codingapi.springboot.security.configurer;

import com.codingapi.springboot.security.filter.AuthenticationTokenFilter;
import com.codingapi.springboot.security.filter.MyAuthenticationFilter;
import com.codingapi.springboot.security.filter.MyLoginFilter;
import com.codingapi.springboot.security.filter.SecurityLoginHandler;
import com.codingapi.springboot.security.gateway.TokenGateway;
import com.codingapi.springboot.security.properties.CodingApiSecurityProperties;
import lombok.AllArgsConstructor;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.DefaultSecurityFilterChain;

@AllArgsConstructor
public class HttpSecurityConfigurer extends SecurityConfigurerAdapter {

    private final TokenGateway tokenGateway;

    private final SecurityLoginHandler securityLoginHandler;
    private final CodingApiSecurityProperties securityJwtProperties;
    private final AuthenticationTokenFilter authenticationTokenFilter;

    @Override
    public void configure(HttpSecurity security) throws Exception {
        AuthenticationManager manager = security.getSharedObject(AuthenticationManager.class);
        security.addFilter(new MyLoginFilter(manager, tokenGateway,securityLoginHandler, securityJwtProperties));
        security.addFilter(new MyAuthenticationFilter(manager, securityJwtProperties, tokenGateway, authenticationTokenFilter));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy