private Authentication convert()

in library/src/main/java/org/apache/fineract/cn/anubis/security/FinKeycloakAuthenticationProvider.java [95:110]


    private Authentication convert(final @Nonnull String user, final String authenticationHeader) {
        final Optional<String> token = getJwtTokenString(authenticationHeader);
        return (Authentication)token.map(x -> {

            final TokenInfo tokenInfo = getTokenInfo(x);//new TokenInfo(TokenType.TENANT, getKeyTimestamp());//getTokenInfo(x);//;//

            switch (tokenInfo.getType()) {
                case TENANT:
                case SYSTEM:
                    return tenantAuthenticator.authenticate(user, x, tokenInfo.getKeyTimestamp());
                default:
                    logger.debug("Authentication failed for a token with a token type other than tenant or system.");
                    throw AmitAuthenticationException.invalidTokenIssuer(tokenInfo.getType().getIssuer());
            }
        }).orElseGet(() -> guestAuthenticator.authenticate(user));
    }