{"openapi":"3.0.3","info":{"title":"COPADO Authentication Service (CAS)","version":"0.7.3-SNAPSHOT","description":"OpenID Connect provider with a GCIP login bridge.\n\nIssuer: `https://auth.copado.com/oidc`.\n\nThe CLI client is `copado_cli_tool` (public, PKCE S256 required).\n\nSwagger **Authorize** uses the `copa_swagger` web client and PKCE."},"servers":[{"url":"https://auth.copado.com","description":"This instance"}],"tags":[{"name":"Health","description":"Liveness and readiness"},{"name":"OpenID Connect","description":"Standard OIDC / OAuth 2.0 endpoints"},{"name":"Interaction","description":"GCIP login bridge used during authorize"}],"paths":{"/health":{"get":{"tags":["Health"],"summary":"Liveness","operationId":"getHealth","responses":{"200":{"description":"Process is up","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"},"example":{"ok":true}}}}}}},"/ready":{"get":{"tags":["Health"],"summary":"Readiness (Redis)","operationId":"getReady","responses":{"200":{"description":"Redis is reachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ready"},"example":{"ok":true,"redis":"up"}}}},"503":{"description":"Redis is down","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ready"},"example":{"ok":false,"redis":"down"}}}}}}},"/.well-known/jwks.json":{"get":{"tags":["OpenID Connect"],"summary":"Copa identity JSON Web Key Set","description":"Public keys that verify Copa identity JWTs from the internal mint API and the OAuth `id_token`.","operationId":"getCopaJwks","responses":{"200":{"description":"RSA signing keys","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Jwks"}}}}}}},"/oidc/.well-known/openid-configuration":{"get":{"tags":["OpenID Connect"],"summary":"Discovery document","operationId":"getDiscovery","responses":{"200":{"description":"OIDC metadata","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/oidc/jwks":{"get":{"tags":["OpenID Connect"],"summary":"JSON Web Key Set","operationId":"getJwks","responses":{"200":{"description":"Signing keys","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Jwks"}}}}}}},"/oidc/auth":{"get":{"tags":["OpenID Connect"],"summary":"Authorization endpoint","description":"Starts the authorization-code + PKCE flow. The browser is redirected to GCIP login, then back to `redirect_uri` with `code`.","operationId":"authorize","parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string","default":"copado_cli_tool"}},{"name":"response_type","in":"query","required":true,"schema":{"type":"string","enum":["code"],"default":"code"}},{"name":"redirect_uri","in":"query","required":true,"schema":{"type":"string","format":"uri","default":"http://127.0.0.1:8080/callback"}},{"name":"scope","in":"query","required":true,"schema":{"type":"string","default":"openid email profile offline_access"}},{"name":"code_challenge","in":"query","required":true,"schema":{"type":"string"},"description":"PKCE S256 challenge"},{"name":"code_challenge_method","in":"query","required":true,"schema":{"type":"string","enum":["S256"],"default":"S256"}},{"name":"state","in":"query","required":false,"schema":{"type":"string"}},{"name":"prompt","in":"query","required":false,"schema":{"type":"string","example":"consent"},"description":"Required for `offline_access` / refresh tokens"},{"$ref":"#/components/parameters/TransactionIdHeader"},{"$ref":"#/components/parameters/TransactionIdQuery"}],"responses":{"302":{"description":"Redirect to login, consent, or redirect_uri"},"400":{"description":"Invalid authorize request"}}}},"/oidc/token":{"post":{"tags":["OpenID Connect"],"summary":"Token endpoint","operationId":"token","requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/TokenRequest"}}}},"responses":{"200":{"description":"Tokens issued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"400":{"description":"Token error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}}},"parameters":[{"$ref":"#/components/parameters/TransactionIdHeader"}]}},"/oidc/me":{"get":{"tags":["OpenID Connect"],"summary":"UserInfo","description":"Profile claims for `email` and `profile` scopes. `orgId` and `userId` are on the ID token (`openid` scope).","operationId":"userInfo","security":[{"bearerAuth":[]},{"oidc":["openid"]}],"responses":{"200":{"description":"User claims","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInfo"}}}},"401":{"description":"Missing or invalid access token"}},"parameters":[{"$ref":"#/components/parameters/TransactionIdHeader"}]}},"/oidc/token/introspection":{"post":{"tags":["OpenID Connect"],"summary":"Token introspection (RFC 7662)","operationId":"introspect","requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/IntrospectionRequest"}}}},"responses":{"200":{"description":"Active flag and token metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntrospectionResponse"}}}}},"parameters":[{"$ref":"#/components/parameters/TransactionIdHeader"}]}},"/oidc/token/revocation":{"post":{"tags":["OpenID Connect"],"summary":"Token revocation (RFC 7009)","operationId":"revoke","requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/RevocationRequest"}}}},"responses":{"200":{"description":"Revoked or already invalid"}},"parameters":[{"$ref":"#/components/parameters/TransactionIdHeader"}]}},"/oidc/session/end":{"get":{"tags":["OpenID Connect"],"summary":"End session / logout","operationId":"endSession","parameters":[{"name":"id_token_hint","in":"query","schema":{"type":"string"}},{"name":"post_logout_redirect_uri","in":"query","schema":{"type":"string","format":"uri"}},{"$ref":"#/components/parameters/TransactionIdHeader"},{"$ref":"#/components/parameters/TransactionIdQuery"}],"responses":{"200":{"description":"Session ended or confirmation page"},"302":{"description":"Redirect after logout"}}}},"/interaction/{uid}":{"get":{"tags":["Interaction"],"summary":"Start login or show consent","description":"Redirects to `LOGIN_URL` for a login prompt, or renders the consent Allow/Deny page.","operationId":"getInteraction","parameters":[{"$ref":"#/components/parameters/InteractionUid"},{"$ref":"#/components/parameters/TransactionIdHeader"},{"$ref":"#/components/parameters/TransactionIdQuery"}],"responses":{"200":{"description":"Consent HTML, or fallback login HTML when LOGIN_URL is unset"},"303":{"description":"Redirect to hosted GCIP login"},"400":{"description":"No authenticated session for consent"}}}},"/interaction/{uid}/consent":{"post":{"tags":["Interaction"],"summary":"Allow or deny consent","description":"Completes the consent prompt. `decision=allow` grants scopes; `decision=deny` returns `access_denied` to the client.","operationId":"postInteractionConsent","parameters":[{"$ref":"#/components/parameters/InteractionUid"},{"$ref":"#/components/parameters/TransactionIdHeader"},{"$ref":"#/components/parameters/TransactionIdQuery"}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["decision"],"properties":{"decision":{"type":"string","enum":["allow","deny"]}}}}}},"responses":{"302":{"description":"Resume authorize (code redirect or access_denied)"},"400":{"description":"Invalid decision or no session"}}}},"/interaction/{uid}/return":{"get":{"tags":["Interaction"],"summary":"GCIP fragment handoff page","operationId":"getInteractionReturn","parameters":[{"$ref":"#/components/parameters/InteractionUid"},{"$ref":"#/components/parameters/TransactionIdHeader"},{"$ref":"#/components/parameters/TransactionIdQuery"}],"responses":{"200":{"description":"HTML that POSTs the fragment token to /login","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/interaction/{uid}/login":{"post":{"tags":["Interaction"],"summary":"Complete login with a GCIP ID token","operationId":"postInteractionLogin","parameters":[{"$ref":"#/components/parameters/InteractionUid"},{"$ref":"#/components/parameters/TransactionIdHeader"},{"$ref":"#/components/parameters/TransactionIdQuery"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InteractionLogin"}},"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/InteractionLogin"}}}},"responses":{"200":{"description":"Resume authorize at redirectTo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InteractionLoginResult"}}}},"400":{"description":"Missing idToken","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}}}}},"components":{"parameters":{"TransactionIdHeader":{"name":"x-transaction-id","in":"header","required":false,"schema":{"type":"string","maxLength":128},"description":"Optional correlation ID. If omitted, the server generates one. Echoed as `x-transaction-id` and included as `transaction_id` on errors."},"TransactionIdQuery":{"name":"transaction_id","in":"query","required":false,"schema":{"type":"string","maxLength":128},"description":"Same as `x-transaction-id`, for browser redirects that cannot set custom headers."},"InteractionUid":{"name":"uid","in":"path","required":true,"schema":{"type":"string"},"description":"oidc-provider interaction id"}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"Copa identity JWT"},"oidc":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"https://auth.copado.com/oidc/auth","tokenUrl":"https://auth.copado.com/oidc/token","scopes":{"openid":"Required. Subject plus orgId and userId on the ID token","email":"email and email_verified on UserInfo","profile":"name on UserInfo","offline_access":"Refresh token (also send prompt=consent)"}}}}},"schemas":{"Health":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean"}}},"Ready":{"type":"object","required":["ok","redis"],"properties":{"ok":{"type":"boolean"},"redis":{"type":"string","enum":["up","down"]}}},"Jwks":{"type":"object","properties":{"keys":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"TokenRequest":{"type":"object","required":["grant_type","client_id"],"properties":{"grant_type":{"type":"string","enum":["authorization_code","refresh_token"]},"client_id":{"type":"string","default":"copado_cli_tool"},"code":{"type":"string","description":"Required for authorization_code"},"redirect_uri":{"type":"string","format":"uri","description":"Required for authorization_code; must match authorize"},"code_verifier":{"type":"string","description":"Required PKCE verifier for authorization_code"},"refresh_token":{"type":"string","description":"Required for refresh_token"},"scope":{"type":"string"}}},"TokenResponse":{"type":"object","required":["access_token","token_type","expires_in"],"properties":{"access_token":{"type":"string","description":"Copa identity JWT. Same token as id_token when both are returned. iss is the Copa issuer and sub is the CopaUID."},"token_type":{"type":"string","example":"Bearer"},"expires_in":{"type":"integer","example":3600},"id_token":{"type":"string","description":"Copa identity JWT. iss is the Copa issuer and sub is the CopaUID. The access_token in this response is the same JWT."},"refresh_token":{"type":"string"},"scope":{"type":"string"}}},"UserInfo":{"type":"object","properties":{"sub":{"type":"string","description":"Firebase uid"},"email":{"type":"string"},"email_verified":{"type":"boolean"},"name":{"type":"string"}}},"IntrospectionRequest":{"type":"object","required":["token","client_id"],"properties":{"token":{"type":"string"},"client_id":{"type":"string","default":"copado_cli_tool"},"token_type_hint":{"type":"string","enum":["access_token","refresh_token"]}}},"IntrospectionResponse":{"type":"object","required":["active"],"properties":{"active":{"type":"boolean"},"scope":{"type":"string"},"client_id":{"type":"string"},"sub":{"type":"string"},"exp":{"type":"integer"},"iat":{"type":"integer"},"iss":{"type":"string"},"token_type":{"type":"string"}}},"RevocationRequest":{"type":"object","required":["token","client_id"],"properties":{"token":{"type":"string"},"client_id":{"type":"string","default":"copado_cli_tool"},"token_type_hint":{"type":"string","enum":["access_token","refresh_token"]}}},"InteractionLogin":{"type":"object","required":["idToken"],"properties":{"idToken":{"type":"string","description":"Firebase / GCIP ID token from the hosted login page"}}},"InteractionLoginResult":{"type":"object","properties":{"redirectTo":{"type":"string","format":"uri"}}},"ErrorMessage":{"type":"object","properties":{"error":{"type":"string"},"transaction_id":{"type":"string"}}},"OAuthError":{"type":"object","properties":{"error":{"type":"string"},"error_description":{"type":"string"},"transaction_id":{"type":"string"}}}}}}