library/src/main/java/org/apache/fineract/cn/anubis/security/FinKeycloakAuthenticationProvider.java [70:96]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        this.tenantAuthenticator = tenantAuthenticator;
        this.guestAuthenticator = guestAuthenticator;
        this.logger = logger;
    }

    @Override public boolean supports(final Class<?> clazz) {
        return PreAuthenticatedAuthenticationToken.class.isAssignableFrom(clazz);
    }

    @Override public Authentication authenticate(Authentication authentication)
            throws AuthenticationException {
        if (!PreAuthenticatedAuthenticationToken.class.isAssignableFrom(authentication.getClass()))
        {
            throw AmitAuthenticationException.internalError(
                    "authentication called with unexpected authentication object.");
        }

        final PreAuthenticatedAuthenticationToken preAuthentication = (PreAuthenticatedAuthenticationToken) authentication;

        final String user = (String) preAuthentication.getPrincipal();
        Assert.hasText(user, "user cannot be empty.  This should have been assured in preauthentication");

        return convert(user, (String)preAuthentication.getCredentials());
    }

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



library/src/main/java/org/apache/fineract/cn/anubis/security/IsisAuthenticatedAuthenticationProvider.java [69:95]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    this.tenantAuthenticator = tenantAuthenticator;
    this.guestAuthenticator = guestAuthenticator;
    this.logger = logger;
  }

  @Override public boolean supports(final Class<?> clazz) {
    return PreAuthenticatedAuthenticationToken.class.isAssignableFrom(clazz);
  }

  @Override public Authentication authenticate(Authentication authentication)
      throws AuthenticationException {
    if (!PreAuthenticatedAuthenticationToken.class.isAssignableFrom(authentication.getClass()))
    {
      throw AmitAuthenticationException.internalError(
          "authentication called with unexpected authentication object.");
    }

    final PreAuthenticatedAuthenticationToken preAuthentication = (PreAuthenticatedAuthenticationToken) authentication;

    final String user = (String) preAuthentication.getPrincipal();
    Assert.hasText(user, "user cannot be empty.  This should have been assured in preauthentication");

    return convert(user, (String)preAuthentication.getCredentials());
  }

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



