com.mercateo.spring.security.jwt.token.extractor.InnerClaimsWrapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-security-jwt Show documentation
Show all versions of spring-security-jwt Show documentation
JWT authentication with spring security
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