Interface HttpSecurityPolicy
- All Superinterfaces:
BasePolicy,BaseSecurityPolicy,HttpPolicy
- All Known Subinterfaces:
SecurityPolicy
HttpSecurityPolicy is a Policy that can be used for securing a plan that can require a subscription.
Implementing a HttpSecurityPolicy requires to implement some additional behavior in order to be used by the gateway during the security chain execution that will identify which plan the consumer is using:
BaseSecurityPolicy.order(): to define the priority compared to other security policiesextractSecurityToken(HttpPlainExecutionContext): to extract theSecurityTokenfrom the request execution contextBaseSecurityPolicy.requireSubscription(): to indicate if it require a valid subscription or not
-
Field Summary
Fields inherited from interface io.gravitee.gateway.reactive.api.policy.base.BaseSecurityPolicy
DEFAULT_ORDER -
Method Summary
Modifier and TypeMethodDescriptionio.reactivex.rxjava3.core.Maybe<SecurityToken>Extracts theSecurityTokenfrom the request execution context.default io.reactivex.rxjava3.core.CompletableTheonMessageResponse(MessageExecutionContext)method shouldn't call on aSecurityPolicydefault io.reactivex.rxjava3.core.CompletableTheonResponse(HttpSimpleExecutionContext)method shouldn't call on aSecurityPolicyMethods inherited from interface io.gravitee.gateway.reactive.api.policy.base.BasePolicy
idMethods inherited from interface io.gravitee.gateway.reactive.api.policy.base.BaseSecurityPolicy
order, requireSubscriptionMethods inherited from interface io.gravitee.gateway.reactive.api.policy.http.HttpPolicy
onMessageRequest, onRequest
-
Method Details
-
extractSecurityToken
Extracts theSecurityTokenfrom the request execution context. If no relevantSecurityTokenis found, it returns an empty Maybe, so that policy won't be executed.- Parameters:
ctx- the current request execution context.- Returns:
- the
SecurityTokenfound in the request execution context
-
onResponse
TheonResponse(HttpSimpleExecutionContext)method shouldn't call on aSecurityPolicy- Specified by:
onResponsein interfaceHttpPolicy- Parameters:
ctx- the current request execution context allowing to access the request, response and attributes.- Returns:
- a
UnsupportedOperationException</code
-
onMessageResponse
TheonMessageResponse(MessageExecutionContext)method shouldn't call on aSecurityPolicy- Specified by:
onMessageResponsein interfaceHttpPolicy- Parameters:
ctx- the current request execution context allowing to access the request, response and attributes.- Returns:
- the order of the security policy when multiple security policies can be involved.
-