webcane / readme-app

web application which holds and manages articles to read
0 stars 0 forks source link

OAuth2 UserInfo factory #63

Closed webcane closed 1 year ago

webcane commented 1 year ago

implement factory pattern for OAuth2UserInfoFactory class.

webcane commented 1 year ago

userInfoMap holds OAuth2UserInfoProvider. for example: GithubUserInfoProvider. He creates github UserInfo instance.

  @Override
  public UserInfo getUserInfo(Map<String, Object> attributes) {
    return new GithubOAuth2UserInfo(attributes);
  }
webcane commented 1 year ago

each concrete UserInfo instance knows how to extract id, name, email and imageUrl from the particular OAuth2 attributes. example: GithubOAuth2UserInfo