package com.lantone.userauth.exception;

import com.lantone.common.api.CommonResult;
import org.springframework.security.authentication.DisabledException;
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Description: 全局处理Oauth2抛出的异常
 * @author: rengb
 * @time: 2021/1/5 18:27
 */
@ControllerAdvice
public class Oauth2ExceptionHandler {

    @ResponseBody
    @ExceptionHandler(value = Exception.class)
    public CommonResult handleOauth2(Exception e) {
        return CommonResult.failed(e.getMessage());
    }

}