postProcessRequest method

  1. @override
MockServerHttpRequest postProcessRequest(
  1. MockServerHttpRequest request
)

Returns the request to perform instead of request; usually request itself after changing its headers, cookies, attributes or principal.

Implementation

@override
MockServerHttpRequest postProcessRequest(MockServerHttpRequest request) {
  final now = DateTime.now().millisecondsSinceEpoch ~/ 1000;
  final token = Jwt(
    'token',
    headers: const {'alg': 'none'},
    claims: {'iat': now, 'exp': now + 300, ..._claims},
  );
  return _withContext(
    request,
    JwtAuthenticationToken(
      token,
      _authorities ?? const JwtGrantedAuthoritiesConverter().convert(token),
    ),
  );
}