com.mercateo.spring.security.jwt.token.extractor.InnerClaimsWrapper Maven / Gradle / Ivy
package com.mercateo.spring.security.jwt.token.extractor;
import java.util.Optional;
import com.mercateo.spring.security.jwt.token.claim.JWTClaim;
import io.vavr.collection.List;
import io.vavr.collection.Map;
class InnerClaimsWrapper {
Map wrapInnerClaims(List claims) {
return claims.groupBy(JWTClaim::name).mapValues(this::wrapGroupedClaims);
}
private JWTClaim wrapGroupedClaims(List claims) {
final List reverse = claims.reverse();
Optional innerClaim = Optional.empty();
for (JWTClaim jwtClaim : reverse) {
innerClaim = Optional.of(JWTClaim.builder().from(jwtClaim).innerClaim(innerClaim).build());
}
// noinspection ConstantConditions
return innerClaim.get();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy