resolveRequestAuthentication method

FutureOr<APIAuthentication?> resolveRequestAuthentication(
  1. APIRequest request,
  2. APIAuthentication? authentication
)

Implementation

FutureOr<APIAuthentication?> resolveRequestAuthentication(
    APIRequest request, APIAuthentication? authentication) {
  request.authentication = authentication;
  if (authentication == null) return null;

  var token = authentication.token;
  token.markAccessTime();

  var sessionID = request.sessionID;
  if (sessionID == null) return authentication;

  return _sessionSet.getOrCreate(sessionID).resolveMapped((session) {
    session.tokens.add(token);
    return authentication;
  });
}