Skip to content
Snippets Groups Projects
Commit 87678184 authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Adjust generic OIDC implementation for 3.x

parent ccd554b5
No related merge requests found
......@@ -35,6 +35,7 @@ public class UserProfile extends Entity {
ARSNOVA_GUEST,
LDAP,
CAS,
OIDC,
GOOGLE,
FACEBOOK,
TWITTER
......
......@@ -22,6 +22,7 @@ import de.thm.arsnova.security.User;
import de.thm.arsnova.service.UserService;
import org.pac4j.oauth.profile.facebook.FacebookProfile;
import org.pac4j.oauth.profile.twitter.TwitterProfile;
import org.pac4j.oidc.profile.OidcProfile;
import org.pac4j.oidc.profile.google.GoogleOidcProfile;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
......@@ -65,6 +66,10 @@ public class OauthUserDetailsService implements AuthenticationUserDetailsService
final FacebookProfile profile = (FacebookProfile) token.getDetails();
user = userService.loadUser(UserProfile.AuthProvider.FACEBOOK, profile.getId(),
grantedAuthorities, true);
} else if (token.getDetails() instanceof OidcProfile) {
final OidcProfile profile = (OidcProfile) token.getDetails();
user = userService.loadUser(UserProfile.AuthProvider.OIDC, profile.getId(),
grantedAuthorities, true);
} else {
throw new IllegalArgumentException("AuthenticationToken not supported");
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment