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

org.mapfish.print.servlet.NoOpAuthenticationManager Maven / Gradle / Ivy

There is a newer version: 3.22.0
Show newest version
package org.mapfish.print.servlet;

import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;
import java.util.Collections;

/**
 * A no-op AuthenticationManager.
 */
public class NoOpAuthenticationManager implements AuthenticationManager {
    @Override
    public Authentication authenticate(
            final Authentication authentication) throws AuthenticationException {
        return new Authentication() {
            @Override
            public Collection getAuthorities() {
                return Collections.emptyList();
            }

            @Override
            public Object getCredentials() {
                return "";
            }

            @Override
            public Object getDetails() {
                return null;
            }

            @Override
            public Object getPrincipal() {
                return "";
            }

            @Override
            public boolean isAuthenticated() {
                return false;
            }

            @Override
            public void setAuthenticated(final boolean isAuthenticated) throws IllegalArgumentException {

            }

            @Override
            public String getName() {
                return "anonymous";
            }
        };
    }

    public boolean isEraseCredentialsAfterAuthentication() {
        return true;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy