@SuppressWarnings("unchecked") @Override public String apply(Account account) { Object value = accountFunction.apply(account); if (value == null || (value instanceof Map && Collections.isEmpty((Map) value))) { return null; } if (value instanceof String) { return (String) value; } if (jwt.isEnabled()) { Assert.isInstanceOf(Map.class, value, "stormpathForwardedAccountMapFunction must return a String or Map<String,?> when using JWT."); @SuppressWarnings("ConstantConditions") Map<String, ?> map = (Map<String, ?>) value; return jwtFunction.apply(map); } //else JSON: return jsonFunction.apply(value); } };
@SuppressWarnings("unchecked") @Override public String apply(Account account) { Object value = accountFunction.apply(account); if (value == null || (value instanceof Map && Collections.isEmpty((Map) value))) { return null; } if (value instanceof String) { return (String) value; } if (jwt.isEnabled()) { Assert.isInstanceOf(Map.class, value, "stormpathForwardedAccountMapFunction must return a String or Map<String,?> when using JWT."); @SuppressWarnings("ConstantConditions") Map<String, ?> map = (Map<String, ?>) value; return jwtFunction.apply(map); } //else JSON: return jsonFunction.apply(value); } };
/** * Returns a string representation of the request's associated account or {@code null} if an account is not * available. * <p> * This method locates the account associated with the current request using the * {@link #accountResolver}, converts the located account to a String with the * {@link #accountStringFunction}, and returns the resulting String. * </p> * <p> * If an account cannot be resolved (for example, the request is not authenticated or a user not remembered * from a previous authentication), {@code null} is returned to indicate an account is not available. * </p> * * @param request the inbound request * @param response the outbound response * @return a string representation of the request's associated account or {@code null} if an account is not * available. */ @Override public String get(HttpServletRequest request, HttpServletResponse response) { Account account = accountResolver.getAccount(request); if (account != null) { return accountStringFunction.apply(account); } return null; } }
/** * Returns a string representation of the request's associated account or {@code null} if an account is not * available. * <p> * This method locates the account associated with the current request using the * {@link #accountResolver}, converts the located account to a String with the * {@link #accountStringFunction}, and returns the resulting String. * </p> * <p> * If an account cannot be resolved (for example, the request is not authenticated or a user not remembered * from a previous authentication), {@code null} is returned to indicate an account is not available. * </p> * * @param request the inbound request * @param response the outbound response * @return a string representation of the request's associated account or {@code null} if an account is not * available. */ @Override public String get(HttpServletRequest request, HttpServletResponse response) { Account account = accountResolver.getAccount(request); if (account != null) { return accountStringFunction.apply(account); } return null; } }
JwkResult jwkResult = keyFunction.apply(jwk); key = jwkResult.getKey(); kid = jwkResult.getKeyId();
JwkResult jwkResult = keyFunction.apply(jwk); key = jwkResult.getKey(); kid = jwkResult.getKeyId();