Files
floci/docs/services
Brian Taylor 1e4e8b9ee8 feat(cognito): implement managed login branding (#2869)
* feat(cognito): implement managed login branding

CreateManagedLoginBranding, DescribeManagedLoginBranding,
DescribeManagedLoginBrandingByClient, UpdateManagedLoginBranding and
DeleteManagedLoginBranding were unsupported, so a config declaring
`aws_cognito_managed_login_branding` could not be applied against Floci.

A branding belongs to one app client and is stored on it. Behaviour matches what
the live API does:

- a second branding for the same client raises ManagedLoginBrandingExistsException
- ManagedLoginBrandingId must be a version 4 UUID, checked before the lookup
- Settings is omitted from the response when the caller supplied none, while
  Assets is always returned
- members an update omits are left unchanged

Settings is stored opaquely rather than validated against AWS's unpublished
schema, and ReturnMergedResources does not merge Cognito's default corpus.

Closes #2856

* fix(cognito): reject malformed CreateManagedLoginBranding members

Create coerced an absent UseCognitoProvidedValues to false and silently ignored a
wrongly typed Settings or Assets, so a malformed request produced persisted state.

Measured against AWS:

  neither UseCognitoProvidedValues nor Settings -> InvalidParameterException:
      useCognitoProvidedValues or settings should be specified (but not both)
  Assets of the wrong type   -> SerializationException: Unexpected field type
  UseCognitoProvidedValues of the wrong type -> accepted, not rejected

Create now enforces the first rule and type-checks Settings and Assets. A
non-boolean UseCognitoProvidedValues is still accepted, because AWS accepts it.

AWS answers a wrongly typed Settings with a 500 InternalErrorException; Floci
returns the same client error it returns for Assets rather than reproducing that,
and the divergence is documented.

* fix(cognito): check Assets elements before converting them

The Assets reader validated only the outer array, so a scalar element reached
Jackson's convertValue and escaped as a 500 InternalFailure. This is the same
class of bug as the LogConfigurations one, which I fixed in that reader without
applying it here.

AWS separates the two failures, and they differ from the LogConfigurations rules:

  [1, 2] / ["str"] -> SerializationException: Unexpected value type in payload
  [null]           -> InvalidParameterException: 1 validation error detected:
                      Value '[null]' at 'assets' failed to satisfy constraint:
                      Member must satisfy constraint: [Member must not be null]

A null element is rejected here, where LogConfigurations drops it.

* fix(cognito): match AWS branding source validation

A managed login branding request must select exactly one source of branding,
and the same rule governs create and update. Measured against Cognito in
ap-southeast-1:

  useCognitoProvidedValues  settings   result
  absent                    absent     InvalidParameterException
  true                      absent     accepted
  false                     absent     InvalidParameterException
  absent                    present    accepted
  true                      present    InvalidParameterException
  false                     present    accepted

Create rejected only the neither case, update validated nothing at all, so
naming both members and updating with no source both succeeded where the
service rejects them. Presence of the member is not the test: false selects no
source, which is why it needs settings alongside it.

Reading the flag had to move with it. AWS coerces a JSON string rather than
rejecting it, storing true for "true" and for "yes" and false for "false",
while Jackson maps every string except "true" to false. That turned "yes" into
a request selecting no source, so the coercion now follows the service.

* fix(cognito): reject malformed UseCognitoProvidedValues types

Jackson's asBoolean() maps a number, a JSON null, an object and an array all to
false, so a malformed flag alongside valid Settings passed source validation and
persisted as branding state that was never requested.

Measured against Cognito in ap-southeast-1: 1, null, {} and [] are each a
SerializationException, with or without Settings, while omitting the member is
accepted and stores false. Only booleans and strings are read now, strings still
coerced the way the service coerces them, and everything else raises
SerializationException the way SesController already does.

* fix(cognito): bound managed login branding assets at 40

Neither create nor update checked the documented 40-item maximum on Assets, so
an oversized request was accepted and stored where AWS rejects it.

Measured against Cognito in ap-southeast-1:

  create 40 assets            passes the bound, reaches the source rule
  create 41 assets            InvalidParameterException, length constraint
  create 41 + unknown client  the length error, not the missing client
  update 41 + malformed id    2 validation errors, the length one first
  update malformed id alone   1 validation error, before the pool lookup

The asset and branding-id checks now run before anything is looked up and
share one message, matching those last three rows. DescribeManagedLoginBranding
ran its pool lookup ahead of the branding-id check, which the fourth row shows
is the wrong way round, so it moved with them.

The length message embeds the request model's toString. The blob renders as the
decoded buffer, confirmed at three payload sizes; the decoder used here is the
lenient one so that building a rejection cannot itself fail.
2026-09-02 11:50:47 -04:00
..
2026-05-10 11:53:31 -05:00
2026-05-10 11:53:31 -05:00
2026-08-21 00:09:04 -04:00
2026-09-02 11:39:10 -04:00
2026-08-31 09:03:26 -04:00
2026-05-10 11:53:31 -05:00
2026-05-10 11:53:31 -05:00