Skip to content
This repository was archived by the owner on Sep 28, 2022. It is now read-only.

Commit 2fd0d89

Browse files
author
Dominik František Bučík
authored
Merge pull request #167 from dBucik/fix_storing_saved_user_auth
fix: 🐛 Fix storing SavedUserAuth
2 parents 9bd4bac + c83ecc2 commit 2fd0d89

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

perun-oidc-server/src/main/java/cz/muni/ics/oauth2/model/SavedUserAuthentication.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,21 @@ public SavedUserAuthentication(Authentication src) {
100100
setAuthorities(new HashSet<>(src.getAuthorities()));
101101
setAuthenticated(src.isAuthenticated());
102102
if (src instanceof SavedUserAuthentication) {
103-
this.setAcr(((SavedUserAuthentication) src).getAcr());
103+
SavedUserAuthentication source = (SavedUserAuthentication) src;
104+
this.setAcr(source.getAcr());
105+
this.setAuthenticationDetails(source.getAuthenticationDetails());
104106
} else if (src instanceof ExpiringUsernameAuthenticationToken) {
105107
ExpiringUsernameAuthenticationToken token = (ExpiringUsernameAuthenticationToken) src;
106-
this.acr = ((SamlPrincipal) token.getPrincipal()).getSamlCredential()
108+
SAMLCredential credential = ((SamlPrincipal) token.getPrincipal()).getSamlCredential();
109+
this.setAcr(credential
107110
.getAuthenticationAssertion()
108111
.getAuthnStatements().stream()
109112
.map(AuthnStatement::getAuthnContext)
110113
.map(AuthnContext::getAuthnContextClassRef)
111114
.map(AuthnContextClassRef::getAuthnContextClassRef)
112-
.collect(Collectors.joining());
113-
this.authenticationDetails = new SamlAuthenticationDetails((SAMLCredential) src.getCredentials());
115+
.collect(Collectors.joining())
116+
);
117+
this.setAuthenticationDetails(new SamlAuthenticationDetails(credential));
114118
}
115119
}
116120

0 commit comments

Comments
 (0)