public abstract class AuthDefaultRequest extends Object implements LoginService
| 限定符和类型 | 字段和说明 |
|---|---|
protected AppConfig |
config |
protected AuthSource |
source |
| 构造器和说明 |
|---|
AuthDefaultRequest(AppConfig config,
AuthSource source) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected String |
accessTokenUrl(String code)
返回获取accessToken的url
|
String |
authorize(String state)
返回带
state参数的授权url,授权回调时会带上这个state |
protected abstract AccessToken |
getAccessToken(AuthCallback authCallback)
获取access token
|
protected String |
getRealState(String state)
获取state,如果为空, 则默认取当前日期的时间戳
|
protected abstract com.centit.framework.system.po.UserInfo |
getUserInfo(AccessToken accessToken)
使用token换取用户信息
|
com.centit.framework.common.ResponseData |
login(AuthCallback authCallback)
统一的登录入口。
|
protected String |
refreshTokenUrl(String refreshToken)
返回获取accessToken的url
|
protected String |
revokeUrl(AccessToken accessToken)
返回获取revoke authorization的url
|
protected String |
userInfoUrl(AccessToken accessToken)
返回获取userInfo的url
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitrefresh, revokeprotected AppConfig config
protected AuthSource source
public AuthDefaultRequest(AppConfig config, AuthSource source)
protected abstract AccessToken getAccessToken(AuthCallback authCallback)
authCallback - 授权成功后的回调参数authorize(String)protected abstract com.centit.framework.system.po.UserInfo getUserInfo(AccessToken accessToken)
accessToken - token信息getAccessToken(AuthCallback)public com.centit.framework.common.ResponseData login(AuthCallback authCallback)
authorize(String)授权成功后,会跳转到调用方的相关回调方法中
方法的入参可以使用AuthCallback,AuthCallback类中封装好了OAuth2授权回调所需要的参数login 在接口中 LoginServiceauthCallback - 用于接收回调参数的实体public String authorize(String state)
state参数的授权url,授权回调时会带上这个stateauthorize 在接口中 LoginServicestate - state 验证授权流程的参数,可以防止csrfprotected String accessTokenUrl(String code)
code - 授权码protected String refreshTokenUrl(String refreshToken)
refreshToken - refreshTokenprotected String userInfoUrl(AccessToken accessToken)
accessToken - tokenprotected String revokeUrl(AccessToken accessToken)
accessToken - tokenCopyright © 2021 江苏南大先腾信息产业股份有限公司. All rights reserved.