1 changed files with 0 additions and 87 deletions
@ -1,87 +0,0 @@
@@ -1,87 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2017 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package sample.user; |
||||
|
||||
import org.springframework.security.core.GrantedAuthority; |
||||
import org.springframework.security.core.authority.AuthorityUtils; |
||||
import org.springframework.security.oauth2.core.user.OAuth2User; |
||||
|
||||
import java.util.Collection; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author Joe Grandja |
||||
*/ |
||||
public class GitHubOAuth2User implements OAuth2User { |
||||
private List<GrantedAuthority> authorities = AuthorityUtils.createAuthorityList("ROLE_USER"); |
||||
private String id; |
||||
private String name; |
||||
private String login; |
||||
private String email; |
||||
|
||||
public GitHubOAuth2User() { |
||||
} |
||||
|
||||
@Override |
||||
public Collection<? extends GrantedAuthority> getAuthorities() { |
||||
return this.authorities; |
||||
} |
||||
|
||||
@Override |
||||
public Map<String, Object> getAttributes() { |
||||
Map<String, Object> attributes = new HashMap<>(); |
||||
attributes.put("id", this.getId()); |
||||
attributes.put("name", this.getName()); |
||||
attributes.put("login", this.getLogin()); |
||||
attributes.put("email", this.getEmail()); |
||||
return attributes; |
||||
} |
||||
|
||||
public String getId() { |
||||
return this.id; |
||||
} |
||||
|
||||
public void setId(String id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
@Override |
||||
public String getName() { |
||||
return this.name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
|
||||
public String getLogin() { |
||||
return this.login; |
||||
} |
||||
|
||||
public void setLogin(String login) { |
||||
this.login = login; |
||||
} |
||||
|
||||
public String getEmail() { |
||||
return this.email; |
||||
} |
||||
|
||||
public void setEmail(String email) { |
||||
this.email = email; |
||||
} |
||||
} |
||||
Loading…
Reference in new issue