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

de.coderspack.spring.boot.jwt.library.security.JWTConfigurer Maven / Gradle / Ivy

There is a newer version: 0.0.3
Show newest version
package de.coderspack.spring.boot.jwt.library.security;

import de.coderspack.spring.boot.jwt.library.JWTFilter;
import de.coderspack.spring.boot.jwt.library.factory.TokenFactory;
import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.DefaultSecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;

public class JWTConfigurer extends SecurityConfigurerAdapter {

    private TokenFactory tokenFactory;

    public JWTConfigurer(TokenFactory tokenFactory) {
        this.tokenFactory = tokenFactory;
    }

    @Override
    public void configure(HttpSecurity http) {
        JWTFilter customFilter = new JWTFilter(tokenFactory);
        http.addFilterBefore(customFilter, UsernamePasswordAuthenticationFilter.class);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy