spring security oauth2 微博 授权登录
官网:https://open.weibo.com/wiki/授权机制
**********************
示例
***************
配置文件
application.yml
spring:
security:
oauth2:
client:
registration:
weibo:
provider: weibo
client-id: ******
client-secret: ******
authorization-grant-type: authorization_code
redirect-uri: "{baseUrl}/login/oauth2/code/weibo"
scope: follow_app_official_microblog
provider:
weibo:
authorization-uri: https://api.weibo.com/oauth2/authorize
token-uri: https://api.weibo.com/oauth2/access_token
user-info-uri: https://api.weibo.com/2/users/show.json
***************
oauth2/weibo
WeiboOAuth2User
public class WeiboOAuth2User implements OAuth2User {
private String id;
private String name;
private String province;
private List<GrantedAuthority> authorities= AuthorityUtils.createAuthorityList("ROLE_USER");
private Map<String,Object> attributes;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@Override
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPr