コード例 #1
0
  private void populateContextFromAuthId(String authId) {
    try {
      String sessionId =
          authIdHelper.reconstructAuthId(authId).getClaimsSet().getClaim(SESSION_ID, String.class);
      if (isEmpty(sessionId)) {
        return;
      }

      String contextId = getContextIdFromSessionId(sessionId);
      if (isNotEmpty(contextId)) {
        AuditRequestContext.putProperty(AUTH.toString(), contextId);
      }
    } catch (RestAuthException e) {
      debug.warning("No session ID found when trying to audit an authentication request.");
    }
  }
コード例 #2
0
  @Override
  protected Map<String, String> getContextsForAccessOutcome(Response response) {
    String tokenId = AuditRequestContext.getProperty(TOKEN_ID);
    String sessionId = AuditRequestContext.getProperty(SESSION_ID);
    String authId = AuditRequestContext.getProperty(AUTH_ID);
    if (isNotEmpty(tokenId)) {
      populateContextFromTokenId(tokenId);

    } else if (isNotEmpty(sessionId)) {
      AuditRequestContext.putProperty(AUTH.toString(), getContextIdFromSessionId(sessionId));

    } else if (isNotEmpty(authId)) {
      populateContextFromAuthId(authId);
    }

    return super.getContextsForAccessOutcome(response);
  }