fix: 🐛 Fix storing SavedUserAuth
Caused SAML claim sources not to work in USERINFO and ID_TOKENpull/1580/head
parent
9bd4bac4ae
commit
c83ecc28e2
|
@ -100,17 +100,21 @@ public class SavedUserAuthentication implements Authentication {
|
||||||
setAuthorities(new HashSet<>(src.getAuthorities()));
|
setAuthorities(new HashSet<>(src.getAuthorities()));
|
||||||
setAuthenticated(src.isAuthenticated());
|
setAuthenticated(src.isAuthenticated());
|
||||||
if (src instanceof SavedUserAuthentication) {
|
if (src instanceof SavedUserAuthentication) {
|
||||||
this.setAcr(((SavedUserAuthentication) src).getAcr());
|
SavedUserAuthentication source = (SavedUserAuthentication) src;
|
||||||
|
this.setAcr(source.getAcr());
|
||||||
|
this.setAuthenticationDetails(source.getAuthenticationDetails());
|
||||||
} else if (src instanceof ExpiringUsernameAuthenticationToken) {
|
} else if (src instanceof ExpiringUsernameAuthenticationToken) {
|
||||||
ExpiringUsernameAuthenticationToken token = (ExpiringUsernameAuthenticationToken) src;
|
ExpiringUsernameAuthenticationToken token = (ExpiringUsernameAuthenticationToken) src;
|
||||||
this.acr = ((SamlPrincipal) token.getPrincipal()).getSamlCredential()
|
SAMLCredential credential = ((SamlPrincipal) token.getPrincipal()).getSamlCredential();
|
||||||
|
this.setAcr(credential
|
||||||
.getAuthenticationAssertion()
|
.getAuthenticationAssertion()
|
||||||
.getAuthnStatements().stream()
|
.getAuthnStatements().stream()
|
||||||
.map(AuthnStatement::getAuthnContext)
|
.map(AuthnStatement::getAuthnContext)
|
||||||
.map(AuthnContext::getAuthnContextClassRef)
|
.map(AuthnContext::getAuthnContextClassRef)
|
||||||
.map(AuthnContextClassRef::getAuthnContextClassRef)
|
.map(AuthnContextClassRef::getAuthnContextClassRef)
|
||||||
.collect(Collectors.joining());
|
.collect(Collectors.joining())
|
||||||
this.authenticationDetails = new SamlAuthenticationDetails((SAMLCredential) src.getCredentials());
|
);
|
||||||
|
this.setAuthenticationDetails(new SamlAuthenticationDetails(credential));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue