メインコンテンツまでスキップ
バージョン: 🚧 Canary

✅ Attribute validators

Attribute mutations compose shared authentication and administrator validators in the order shown by the route source.

Inventory

ValidatorReadsSuccess conditionFailure / errorConsumers
isAuthenticated()context.authenticate, or the Bearer fallbackThe selected token adapter authenticates the request.Adapter authentication error.createAttributeRoute, updateAttributeRoute, deleteAttributeRoute
checkIdentityType(['admin'])Auth adapter, db.identities, configuration.identity.typeIdsThe authenticated identity's typeId equals configured admin.500 missing setup; 401 invalid token; 403 unavailable, malformed, or non-admin identity.createAttributeRoute, updateAttributeRoute, deleteAttributeRoute

Details

isAuthenticated()

Implementation

Signature: isAuthenticated(): Validator. This shared factory calls context.authenticate(payload), falling back to Bearer authentication. attributesService injects Bearer mode unless authMode is 'cookie'; then it injects cookie authentication. See the Authentication validator.

Consumers: createAttributeRoute, updateAttributeRoute, and deleteAttributeRoute, before checkIdentityType(['admin']).

checkIdentityType(['admin'])

Implementation

Signature: checkIdentityType(['admin']): Validator. This shared factory requires db.identities and configuration.identity.typeIds, authenticates the request, loads its identity, then compares typeId with typeIds.admin. See the Authentication validator.

Consumers: createAttributeRoute, updateAttributeRoute, and deleteAttributeRoute, after isAuthenticated().