CoSecAutoConfiguration

@AutoConfiguration(before = [WowAutoConfiguration::class])
@ConditionalOnClass(name = ["me.ahoo.wow.cosec.CoSecCallerResolver", "me.ahoo.cosec.webflux.ServerWebExchanges"])
@EnableConfigurationProperties(value = [WowProperties::class])
class CoSecAutoConfiguration

Wires CoSec into the host when the application has wow-cosec and CoSec's WebFlux module: the host wires its optional integrations as it wires Kafka, and wow-cosec keeps the Spring-free part, the resolver, the authorizers and the route map. It reads wow.cosec.* once, through WowProperties.cosec, the keys' one reader and one default.

  • CoSecCallerResolver is the host's CallerResolver when CoSec is on (cosec.enabled, true unless set) and the application has none: the host's development callers (DevelopmentCallerResolver) step aside. Its options are wow.tenant.default, wow.cosec.cross-scope.roles and wow.cosec.tenant-level.roles (the tenant-level callers), comma-separated or indexed lists. The caller's app and space are those of the scope CoSec resolved, behind a CoSec gateway (wow.cosec.mode=gateway) the ones the gateway forwarded. No CoSec principal is a service identity: a service names itself on the internal port.

  • The app of the request's scope is the standard fact app_id. CoSec's device id, CoSec-Device-Id, a client's persistent identifier, is recorded only when the application lists it in wow.http.request-facts, as any header: Wow adds no personal data of its own to a command.

  • With CoSec on, CoSec-Request-Id is the request id of a command without Wow-Request-Id (CoSecRequestIds), so a command a CoSec gateway sends again under the same header is answered as a duplicate. With it off, Wow reads no header of CoSec's.

  • Where CoSec decides the requests itself, the route map CoSec's pipeline reads is the Manifest's command and service routes (CoSecRouteMapAutoConfiguration).

  • CoSecCommandAuthorizer and CoSecServiceRouteAuthorizer, CoSec's decision on a command and on a service route call, are the node's authorizers when wow.cosec.authorizer.enabled is true and CoSec decides here: an auto-configuration of their own after CoSec's pipeline, which defines the checker they ask (CoSecAuthorizersAutoConfiguration).

Experimental as wow-cosec is in 10.0: the class and its constant may change within 10.x until a 10.x minor release drops the marker.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
@Bean
@ConditionalOnProperty(value = ["cosec.enabled"], havingValue = "true", matchIfMissing = true)
fun wowCoSecCallerResolver(properties: WowProperties): CoSecCallerResolver
Link copied to clipboard
@Bean
@ConditionalOnProperty(value = ["cosec.enabled"], havingValue = "true", matchIfMissing = true)
fun wowCoSecPlatformRoles(properties: WowProperties): PlatformRoles

CoSec's cross-scope roles (wow.cosec.cross-scope.roles) as platform roles, so that the edge refuses a caller of another tenant than the platform's that holds one (#7346). A configured name only adds a refusal, never removes one: a service's own platform roles stay declared in code.

Link copied to clipboard
@Bean
@ConditionalOnProperty(value = ["wow.cosec.problems"], havingValue = "wow")
@ConditionalOnMissingBean(type = ["me.ahoo.cosec.runtime.http.ProblemRenderer"])
fun wowCoSecProblemRenderer(): CoSecProblemRenderer

Writes CoSec's refusals as Wow's problems when wow.cosec.problems is wow and the application declares no ProblemRenderer of its own, which wins: CoSec takes one renderer and refuses to start with two.

Link copied to clipboard
@Bean
@ConditionalOnProperty(value = ["wow.cosec.problems"], havingValue = "wow")
fun wowCoSecProblemsNotice(beans: ListableBeanFactory): SmartInitializingSingleton

Says at startup who writes CoSec's refusals when wow.cosec.problems is wow: Wow, or the application.