mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 14:30:28 -05:00
With TLS on, an issuer Floci serves itself, a Floci Cognito user pool for one, presents a certificate of Floci's local CA. The JWT verifier fetched its discovery document and JWKS with the JVM's default trust store, which does not hold that CA, so every token of a Floci pool was refused with 401 by an HTTP API JWT authorizer (and by an AppSync OIDC provider), where the same authorizer on a Cognito pool verifies on AWS. FLOCI_SECURITY_ALLOW_PRIVATE_JWT_TARGETS only lets the fetch reach the private address; the handshake still failed. The verifier now trusts the CA bundle Floci already writes for the containers it launches: the JVM's roots followed by Floci's own trust anchor (the local CA, or the user's certificate file). ContainerCaBundle gains sslContext(), an SSL context over that bundle, empty when TLS is off or the bundle cannot be read, in which case the JVM's roots alone are trusted as before. A readable bundle with no certificate in it is refused the same way, since a trust store over it would trust nothing, public issuers included. The warning for a missing bundle now also says that JWT authorizers will refuse an issuer Floci serves. The TLS server context of a certificate this CA issues moves from the RDS proxy into FlociCertificateAuthority.serverSslContext, so the proxy and the test that serves an issuer over HTTPS build it one way. Tests: JwtSignatureVerifierTest serves an issuer over HTTPS with a certificate Floci's CA issues, the bundle written by ContainerCaBundle and the verifier built through its injected constructor, as in production: refused by the JVM's roots, verified with the bundle (it fails on main). ContainerCaBundleTest pins that the bundle's context still trusts every JVM root and the anchor, and that an empty bundle falls back. OidcAuthValidatorTest's mocked config now answers tls().