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)
A non-validated JWT is constructed based on tenant information.
|
JwtBasedRequestContextExecutor |
onBehalfOfTenant(String tenantId,
String issuerUrl,
Collection<String> audiences)
A non-validated JWT is constructed based on tenant information.
|
JwtBasedRequestContextExecutor |
onBehalfOfTenant(String tenantId,
String issuerUrl,
String... audiences)
Deprecated.
Use
onBehalfOfTenant(String) or onBehalfOfTenant(String, String, Collection)
instead. |
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
@Deprecated @Nonnull public JwtBasedRequestContextExecutor onBehalfOfTenant(@Nonnull String tenantId, @Nullable String issuerUrl, @Nonnull String... audiences)
onBehalfOfTenant(String)
or onBehalfOfTenant(String, String, Collection)
instead.RequestContext
as if it was called from HttpServletRequest
. Operations in this context are
executed on behalf of the subscriber tenant provided. The generated JWT contains default values for issuer URL
and audience.tenantId
- The tenant identifier to be used and acted on behalf of.issuerUrl
- The optional issuer URL. If no value is provided, a dummy issuer URL will be constructed by taking the
tenantId as subdomain, which will in most cases not allow to use features that rely on the issuer URL,
such as accessing multi-tenant services.audiences
- A customizable array of JWT audience entries. If the array is empty, the application name will be
used.@Nonnull public JwtBasedRequestContextExecutor onBehalfOfTenant(@Nonnull String tenantId)
RequestContext
as if it was called from HttpServletRequest
. Operations in this context are
executed on behalf of the subscriber tenant provided. The generated JWT contains default values for issuer URL
and audience, which will in most cases not allow to use features that rely on the issuer URL, such as accessing
multi-tenant services.tenantId
- The tenant identifier to be used and acted on behalf of.@Nonnull public JwtBasedRequestContextExecutor onBehalfOfTenant(@Nonnull String tenantId, @Nonnull String issuerUrl, @Nonnull Collection<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 issuer URL of the subscriber XSUAA endpoint.audiences
- A customizable array of JWT audience entries. Adding the application name is recommended.@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.