mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 11:34:26 +00:00
a301c40f9f
* command/crypto: DRY the code - reuse the the algorithm switch to create a secret generator - add a verifyCryptoCode function * command: crypto code tests * migrate webauthn package * finish integration tests with webauthn mock client
17 lines
370 B
Go
17 lines
370 B
Go
package authz
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zitadel/zitadel/internal/errors"
|
|
)
|
|
|
|
// UserIDInCTX checks if the userID
|
|
// equals the authenticated user in the context.
|
|
func UserIDInCTX(ctx context.Context, userID string) error {
|
|
if GetCtxData(ctx).UserID != userID {
|
|
return errors.ThrowUnauthenticated(nil, "AUTH-Bohd2", "Errors.User.UserIDWrong")
|
|
}
|
|
return nil
|
|
}
|