public class AuthBaiduRequest extends AuthDefaultRequest
authStateCache, config, source
Constructor and Description |
---|
AuthBaiduRequest(AuthConfig config) |
AuthBaiduRequest(AuthConfig config,
AuthStateCache authStateCache) |
Modifier and Type | Method and Description |
---|---|
String |
authorize(String state)
返回带
state 参数的授权url,授权回调时会带上这个state |
protected AuthToken |
getAccessToken(AuthCallback authCallback)
获取access token
|
protected AuthUser |
getUserInfo(AuthToken authToken)
https://openapi.baidu.com/rest/2.0/passport/users/getInfo?access_token=121.c86e87cc0828cc1dabb8faee540531d4.YsUIAWvYbgqVni1VhkgKgyLh8nEyELbDOEZs_OA.OgDgmA
https://openapi.baidu.com/rest/2.0/passport/users/getInfo?access_token=121.2907d9facf9fb97adf7287fa75496eda.Y3NSjR3-3HKt1RgT0HEl7GgxRXT5gOOVdngXezY.OcC_7g
新旧应用返回的用户信息不一致
|
AuthResponse |
refresh(AuthToken authToken)
刷新access token (续期)
|
AuthResponse |
revoke(AuthToken authToken)
撤销授权
|
accessTokenUrl, authorize, doGetAuthorizationCode, doGetRevoke, doGetUserInfo, doPostAuthorizationCode, doPostRevoke, doPostUserInfo, getRealState, getScopes, login, refreshTokenUrl, revokeUrl, userInfoUrl
public AuthBaiduRequest(AuthConfig config)
public AuthBaiduRequest(AuthConfig config, AuthStateCache authStateCache)
protected AuthToken getAccessToken(AuthCallback authCallback)
AuthDefaultRequest
getAccessToken
in class AuthDefaultRequest
authCallback
- 授权成功后的回调参数AuthDefaultRequest.authorize()
,
AuthDefaultRequest.authorize(String)
protected AuthUser getUserInfo(AuthToken authToken)
getUserInfo
in class AuthDefaultRequest
authToken
- token信息AuthDefaultRequest.getAccessToken(AuthCallback)
public AuthResponse revoke(AuthToken authToken)
AuthRequest
authToken
- 登录成功后返回的Token信息public AuthResponse refresh(AuthToken authToken)
AuthRequest
authToken
- 登录成功后返回的Token信息public String authorize(String state)
state
参数的授权url,授权回调时会带上这个state
authorize
in interface AuthRequest
authorize
in class AuthDefaultRequest
state
- state 验证授权流程的参数,可以防止csrfCopyright © 2021. All rights reserved.