public class JwtBasedRequestContextExecutor extends BaseRequestContextExecutor<JwtBasedRequestContextExecutor>
Callable
or Executable
as if it would have been
invoked via a HttpServletRequest
with the given JWT bearer as part of the "Authorization" header.Constructor and Description |
---|
JwtBasedRequestContextExecutor() |
Modifier and Type | Method and Description |
---|---|
protected JwtBasedRequestContextExecutor |
getThis()
Getter needed to allow for a type safe return in the builder methods.
|
JwtBasedRequestContextExecutor |
onBehalfOfTenant(String tenantId,
String issuerUrl,
String... audiences)
A non-validated JWT is constructed based on tenant information.
|
JwtBasedRequestContextExecutor |
withJwt(String encodedJwt)
The given JWT is used to initialize the
RequestContext as if it was called from
HttpServletRequest . |
JwtBasedRequestContextExecutor |
withJwt(String encodedJwt,
String refreshToken)
The given JWT is used to initialize the
RequestContext as if it was called from
HttpServletRequest . |
JwtBasedRequestContextExecutor |
withXsuaaServiceJwt()
Retrieves a JWT from the bound XSUAA service and initialize this RequestContextExecutor with it.
|
execute, execute, withListeners, withoutDefaultListeners, withoutListener, withoutListeners, withParentRequestContext, withRequestContext
@Nonnull public JwtBasedRequestContextExecutor onBehalfOfTenant(@Nonnull String tenantId, @Nullable String issuerUrl, @Nonnull String... audiences)
RequestContext
as if it was called from HttpServletRequest
. Operations in this context are
executed on behalf of the subscriber tenant provided.tenantId
- The tenant identifier to be used and acted on behalf of.issuerUrl
- The optional issuer URL. If no value is provided, the issuer URL will be constructed by taking the
tenantId as subdomain.audiences
- A customizable array of JWT audience entries.@Nonnull public JwtBasedRequestContextExecutor withJwt(@Nonnull String encodedJwt)
RequestContext
as if it was called from
HttpServletRequest
.encodedJwt
- The encoded JWT to be used.@Nonnull public JwtBasedRequestContextExecutor withJwt(@Nonnull String encodedJwt, @Nonnull String refreshToken)
RequestContext
as if it was called from
HttpServletRequest
. Also takes a refresh token to refresh the given JWT if expired.encodedJwt
- The encoded JWT to be used.refreshToken
- The refresh token to be used to refresh the JWT if necessary.@Nonnull public JwtBasedRequestContextExecutor withXsuaaServiceJwt()
Probable use cases for this are tasks that should run without any request, so e.g. start-up tasks and handling of received messages.
@Nonnull protected JwtBasedRequestContextExecutor getThis()
BaseRequestContextExecutor
protected ImplementingType getThis() { return this; }in the subclasses.
getThis
in class BaseRequestContextExecutor<JwtBasedRequestContextExecutor>
Copyright © 2019 SAP SE. All rights reserved.