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

io.irain.reactor.security.handler.AuthEntryPoint Maven / Gradle / Ivy

There is a newer version: 1.0.3
Show newest version
package io.irain.reactor.security.handler;

import io.irain.reactor.commons.exception.ServerException;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.server.ServerAuthenticationEntryPoint;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * 身份认证失败.
 *
 * @author youta
 **/
@Component
public class AuthEntryPoint implements ServerAuthenticationEntryPoint {
    @Override
    public Mono commence(ServerWebExchange exchange, AuthenticationException ex) {
        //抛出异常,交由全局异常处理器处理
        throw new ServerException(401,"Authentication failed");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy