Skip to content

@sourceloop/authentication-service / Exports / SecureResourceOwnerVerifyProvider

Class: SecureResourceOwnerVerifyProvider

Implements

  • Provider<VerifyFunction.SecureResourceOwnerPasswordFn>

Table of contents

Constructors

Properties

Methods

Constructors

constructor

• new SecureResourceOwnerVerifyProvider(userRepository, utRepository, authSecureClientRepository, otpRepository)

Parameters

Name Type
userRepository UserRepository
utRepository UserTenantRepository
authSecureClientRepository AuthSecureClientRepository
otpRepository OtpRepository

Defined in

services/authentication-service/src/modules/auth/providers/secure-resource-owner-verify.provider.ts:25

Properties

authSecureClientRepository

• authSecureClientRepository: AuthSecureClientRepository

Defined in

services/authentication-service/src/modules/auth/providers/secure-resource-owner-verify.provider.ts:31


otpRepository

• otpRepository: OtpRepository

Defined in

services/authentication-service/src/modules/auth/providers/secure-resource-owner-verify.provider.ts:33


userRepository

• userRepository: UserRepository

Defined in

services/authentication-service/src/modules/auth/providers/secure-resource-owner-verify.provider.ts:27


utRepository

• utRepository: UserTenantRepository

Defined in

services/authentication-service/src/modules/auth/providers/secure-resource-owner-verify.provider.ts:29

Methods

ensureUserIsActiveInTenant

▸ Private ensureUserIsActiveInTenant(user): Promise<void>

Parameters

Name Type
user User<DataObject<Model>>

Returns

Promise<void>

Defined in

services/authentication-service/src/modules/auth/providers/secure-resource-owner-verify.provider.ts:80


validateClientAccess

▸ Private validateClientAccess(clientId, clientSecret, user): Promise<AuthSecureClient>

Parameters

Name Type
clientId string
clientSecret string
user User<DataObject<Model>>

Returns

Promise<AuthSecureClient>

Defined in

services/authentication-service/src/modules/auth/providers/secure-resource-owner-verify.provider.ts:96


value

▸ value(): SecureResourceOwnerPasswordFn<IAuthSecureClient, IAuthUser>

The function verifies the secure resource owner password for a client and user.

Returns

SecureResourceOwnerPasswordFn<IAuthSecureClient, IAuthUser>

The value() function returns a SecureResourceOwnerPasswordFn function, which is an asynchronous function that takes clientId, clientSecret, username, and password as parameters. Inside the function, it verifies the user's password or OTP, checks the user's status, validates the client, and returns an object containing the client and user if all validations pass.

Implementation of

Provider.value

Defined in

services/authentication-service/src/modules/auth/providers/secure-resource-owner-verify.provider.ts:44


verifyUserOrOtp

▸ Private verifyUserOrOtp(username, password): Promise<User<DataObject<Model>>>

Parameters

Name Type
username string
password string

Returns

Promise<User<DataObject<Model>>>

Defined in

services/authentication-service/src/modules/auth/providers/secure-resource-owner-verify.provider.ts:60