package com.tofly.common.oauth.exception;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.tofly.common.oauth.compent.ToflyAuth2ExceptionSerializer;
import org.springframework.http.HttpStatus;

/**
 * @author Administrator
 * @date 2019/9/12  14:02
 */
@JsonSerialize(using = ToflyAuth2ExceptionSerializer.class)
public class UnauthorizedException extends ToflyAuth2Exception{
    public UnauthorizedException(String msg, Throwable t) {
        super(msg);
    }

    @Override
    public String getOAuth2ErrorCode() {
        return "unauthorized";
    }

    @Override
    public int getHttpErrorCode() {
        return HttpStatus.UNAUTHORIZED.value();
    }
}
