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

com.netgrif.application.engine.configuration.authentication.providers.NetgrifAuthenticationProvider Maven / Gradle / Ivy

Go to download

System provides workflow management functions including user, role and data management.

There is a newer version: 6.3.3
Show newest version
package com.netgrif.application.engine.configuration.authentication.providers;

import com.netgrif.application.engine.auth.service.interfaces.ILoginAttemptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

import javax.servlet.http.HttpServletRequest;

public abstract class NetgrifAuthenticationProvider implements AuthenticationProvider {


    @Autowired
    protected UserDetailsService userDetailsService;

    @Autowired
    protected HttpServletRequest request;

    @Autowired
    protected ApplicationEventPublisher publisher;

    @Autowired
    protected ILoginAttemptService loginAttemptService;


    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        return null;
    }

    public abstract Authentication authenticate(Authentication authentication);

    public abstract boolean supports(Class authentication);

    protected String getClientIP() {
        String xfHeader = request.getHeader("X-Forwarded-For");
        if (xfHeader == null) {
            return request.getRemoteAddr();
        }
        return xfHeader.split(",")[0];
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy