Last change
on this file since 0f5aa27 was 0f5aa27, checked in by darsov2 <62809499+darsov2@…>, 6 months ago |
ouath, mailing impl
|
-
Property mode
set to
100644
|
File size:
801 bytes
|
Line | |
---|
1 | package com.tourMate.config.oauth2;
|
---|
2 |
|
---|
3 | import com.tourMate.entities.Providers;
|
---|
4 |
|
---|
5 | import java.util.Map;
|
---|
6 |
|
---|
7 | public class OAuth2UserDetailsFactory {
|
---|
8 | public static OAuth2UserDetails createOAuth2UserDetails (String registrationId, Map<String, Object> attributes)
|
---|
9 | {
|
---|
10 | if(registrationId.equals(Providers.google.name()))
|
---|
11 | {
|
---|
12 | return new OAuth2GoogleUser(attributes);
|
---|
13 | }
|
---|
14 | else if(registrationId.equals(Providers.facebook.name()))
|
---|
15 | {
|
---|
16 | return new OAuth2FacebookUser(attributes);
|
---|
17 | }
|
---|
18 | else if(registrationId.equals(Providers.github.name()))
|
---|
19 | {
|
---|
20 | return new OAuth2GitHubUser(attributes);
|
---|
21 | }
|
---|
22 | else
|
---|
23 | {
|
---|
24 | throw new RuntimeException("Login with this provider is not supported!");
|
---|
25 | }
|
---|
26 | }
|
---|
27 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.