init
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package com.newyetai.security.expection;
|
||||
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
|
||||
import com.newyetai.common.AlitaResult;
|
||||
|
||||
/**
|
||||
* 登录信息异常
|
||||
*
|
||||
* @author sr on 2020-06-15
|
||||
*/
|
||||
public class BadLoginException extends AuthenticationException {
|
||||
|
||||
/** **/
|
||||
private static final long serialVersionUID = -5461032165020284506L;
|
||||
|
||||
private AlitaResult<?> result;
|
||||
|
||||
public BadLoginException(String msg) {
|
||||
super(msg);
|
||||
result = AlitaResult.error(AlitaResult.LOGIN_ERROR_CODE, msg);
|
||||
}
|
||||
|
||||
public BadLoginException(String msg, Throwable t) {
|
||||
super(msg, t);
|
||||
result = AlitaResult.error(AlitaResult.LOGIN_ERROR_CODE, msg);
|
||||
}
|
||||
|
||||
public BadLoginException(AlitaResult<?> result) {
|
||||
super(result.getMsg());
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public AlitaResult<?> getResult(){
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.newyetai.security.expection;
|
||||
|
||||
import com.newyetai.common.AlitaResult;
|
||||
import com.newyetai.security.temptoken.dto.DuplUserToken;
|
||||
|
||||
/**
|
||||
* 多个登录机构异常
|
||||
*
|
||||
* @author sr on 2020-06-15
|
||||
*/
|
||||
public class DuplicateOrgException extends BadLoginException {
|
||||
|
||||
/** **/
|
||||
private static final long serialVersionUID = -5461032165020284506L;
|
||||
|
||||
/** 用户信息 **/
|
||||
private final DuplUserToken duplUserToken;
|
||||
|
||||
public static final String MSG = "登录用户存在多机构";
|
||||
|
||||
public DuplicateOrgException(DuplUserToken duplUserToken) {
|
||||
super(AlitaResult.error(AlitaResult.DUPLICATE_ORG_CODE, MSG, duplUserToken));
|
||||
super.getResult().setErrorData(duplUserToken);
|
||||
this.duplUserToken = duplUserToken;
|
||||
}
|
||||
|
||||
public DuplUserToken getDuplUserToken() {
|
||||
return this.duplUserToken;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.newyetai.security.expection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.newyetai.common.AlitaResult;
|
||||
import com.newyetai.security.temptoken.dto.DuplMobileToken;
|
||||
|
||||
/**
|
||||
* 多个登录用户异常
|
||||
*
|
||||
* @author sr on 2020-06-15
|
||||
*/
|
||||
public class DuplicateUserException extends BadLoginException {
|
||||
|
||||
/** **/
|
||||
private static final long serialVersionUID = -5461032165020284506L;
|
||||
|
||||
/** 用户信息 **/
|
||||
private final DuplMobileToken duplMobileToken;
|
||||
|
||||
public static final String MSG = "登录用户存在多用户";
|
||||
|
||||
public DuplicateUserException(DuplMobileToken duplMobileToken) {
|
||||
super(AlitaResult.error(AlitaResult.DUPLICATE_USER_CODE,
|
||||
MSG, duplMobileToken));
|
||||
super.getResult().setErrorData(duplMobileToken);
|
||||
this.duplMobileToken = duplMobileToken;
|
||||
}
|
||||
|
||||
public DuplMobileToken getDuplMobileToken() {
|
||||
return this.duplMobileToken;
|
||||
}
|
||||
|
||||
public List<?> getUsers(){
|
||||
return this.duplMobileToken.getUsers();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user