-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding attributes to the auth code table and more
- Loading branch information
1 parent
50456ef
commit 9618351
Showing
6 changed files
with
70 additions
and
49 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
orcid-core/src/main/java/org/orcid/core/common/util/AuthenticationUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.orcid.core.common.util; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
import org.orcid.core.oauth.OrcidProfileUserDetails; | ||
import org.springframework.security.core.Authentication; | ||
import org.springframework.security.core.context.SecurityContextHolder; | ||
|
||
public class AuthenticationUtils { | ||
|
||
public static String retrieveEffectiveOrcid() { | ||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); | ||
if (authentication.getDetails() != null) { | ||
if(OrcidProfileUserDetails.class.isAssignableFrom(authentication.getDetails().getClass())) { | ||
return ((OrcidProfileUserDetails) authentication.getDetails()).getOrcid(); | ||
} else { | ||
// From the authorization server we will get the effective user from authentication.getName() | ||
String orcid = authentication.getName(); | ||
if(StringUtils.isNotBlank(orcid)) { | ||
return orcid; | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
orcid-web/src/main/java/org/orcid/frontend/spring/session/OrcidRedisSessionRepository.java
This file was deleted.
Oops, something went wrong.