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

io.irain.reactor.security.handler.AuthAccessDeniedHandler 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.access.AccessDeniedException;
import org.springframework.security.web.server.authorization.ServerAccessDeniedHandler;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * 权限不足处理.
 *
 * @author youta
 **/
@Component
public class AuthAccessDeniedHandler implements ServerAccessDeniedHandler {
    @Override
    public Mono handle(ServerWebExchange exchange, AccessDeniedException denied) {
        //抛出异常,交由全局异常处理器处理
        throw new ServerException(403,"Access denied");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy