Class: BaseOAuthClientRouteMongo
Defined in: auth/src/routes/mongo/BaseOAuthClientRouteMongo.ts:11
Owner/admin CRUD for Client, the registered OAuth 2.0 / OpenID Connect applications this authorization
server issues tokens to.
Client's class-level ACL only grants .* the ability to CREATE (see ClientSQL/ClientMongo's
@Protect records, shaped exactly like Secret's) — everything else a caller can do to a specific
Client comes from a per-record grant. RepoUtils.create() automatically grants the creator full CRUD on
their own new record (unless they hold a trusted role, which already gets blanket access to every record
via ACLUtils.hasPermission()), so an authenticated non-admin caller can register and fully manage their
own client with zero bespoke access-control code here — the same "self-service owner, blanket admin"
pattern Secret already uses. This is what lets a future self-service "manage my own clients" UI be
purely a UI-exposure decision later, not a re-architecture now.
Extends
Constructors
Constructor
new BaseOAuthClientRouteMongo():
BaseOAuthClientRouteMongo
Returns
BaseOAuthClientRouteMongo
Inherited from
BaseOAuthClientRoute.constructor
Properties
_objectFactory?
protectedoptional_objectFactory?:ObjectFactory
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:101
Inherited from
BaseOAuthClientRoute._objectFactory
aclUtils?
protectedoptionalaclUtils?:ACLUtils
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:102
Inherited from
config?
protectedoptionalconfig?:any
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:104
The global application configuration.
Inherited from
defaultACLUid
protecteddefaultACLUid:string
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:106
The unique identifier of the default ACL for the model type.
Inherited from
BaseOAuthClientRoute.defaultACLUid
logger
protectedlogger:any
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:107
Inherited from
notificationUtils?
protectedoptionalnotificationUtils?:NotificationUtils
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:108
Inherited from
BaseOAuthClientRoute.notificationUtils
repoUtils?
protectedoptionalrepoUtils?:RepoUtils<ClientMongo>
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:112
The repository utility class to use for common operations.
Inherited from
BaseOAuthClientRoute.repoUtils
repoUtilsClass
protectedreadonlyrepoUtilsClass:any
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/CRUDRoute.d.ts:33
The class of the RepoUtils to use when instantiating the utility.
Inherited from
BaseOAuthClientRoute.repoUtilsClass
trackChanges
protectedtrackChanges:number
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:117
The number of previous document versions to store in the database. A negative value indicates storing all
versions, a value of 0 stores no versions.
Inherited from
BaseOAuthClientRoute.trackChanges
trustedRoles
protectedtrustedRoles:string[]
Defined in: auth/src/routes/BaseOAuthClientRoute.ts:39
Inherited from
BaseOAuthClientRoute.trustedRoles
Accessors
modelClass
Get Signature
get modelClass():
any
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:122
The class type of the model this route is associated with.
Returns
any
Inherited from
BaseOAuthClientRoute.modelClass
Methods
count()
count(
params,query,res,user?):Promise<any>
Defined in: auth/src/routes/BaseOAuthClientRoute.ts:160
Parameters
params
any
query
any
res
HttpResponse
user?
JWTUser
Returns
Promise<any>
Inherited from
create()
create(
obj,req,user?):Promise<ClientMongo|ClientMongo[]>
Defined in: auth/src/routes/BaseOAuthClientRoute.ts:117
Parameters
obj
req
HttpRequest
user?
JWTUser
Returns
Promise<ClientMongo | ClientMongo[]>
Inherited from
delete()
delete(
id,version,purge,req,user?):Promise<void>
Defined in: auth/src/routes/BaseOAuthClientRoute.ts:171
Parameters
id
string
version
string | undefined
purge
string | undefined
req
HttpRequest
user?
JWTUser
Returns
Promise<void>
Inherited from
doBulkCreate()
protecteddoBulkCreate(objs,options):Promise<ClientMongo[]>
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:151
Attempts to store a collection of objects provided in options.req.body into the datasource. Upon success, sets the newly persisted
object(s) to the result property of the options.res argument, otherwise sends a 400 BAD REQUEST response to the
client.
Parameters
objs
Partial<ClientMongo>[]
The object(s) to store in the database.
options
CreateRequestOptions
The options to process the request using.
Returns
Promise<ClientMongo[]>
Inherited from
BaseOAuthClientRoute.doBulkCreate
doBulkUpdate()
protecteddoBulkUpdate(objs,options):Promise<ClientMongo[]>
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:203
Attempts to modify a collection of existing data model objects.
Parameters
objs
UpdateObject<ClientMongo>[]
The object(s) to bulk update in the database.
options
UpdateRequestOptions<ClientMongo>
The options to process the request using.
Returns
Promise<ClientMongo[]>
Inherited from
BaseOAuthClientRoute.doBulkUpdate
doCount()
protecteddoCount(options):Promise<HttpResponse>
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:133
Attempts to retrieve the number of data model objects matching the given set of criteria as specified in the
request query. Any results that have been found are set to the content-length header of the res argument.
Parameters
options
FindRequestOptions
The options to process the request using.
Returns
Promise<HttpResponse>
Inherited from
doCreate()
protecteddoCreate(obj,options):Promise<ClientMongo|ClientMongo[]>
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:160
Attempts to store one or more objects provided in options.req.body into the datasource. Upon success, sets the newly persisted
object(s) to the result property of the options.res argument, otherwise sends a 400 BAD REQUEST response to the
client.
Parameters
obj
Partial<ClientMongo> | Partial<ClientMongo>[]
The object(s) to store in the database.
options
CreateRequestOptions
The options to process the request using.
Returns
Promise<ClientMongo | ClientMongo[]>
Inherited from
doCreateObject()
protecteddoCreateObject(obj,options):Promise<ClientMongo>
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:142
Attempts to store an object provided in options.req.body into the datasource. Upon success, sets the newly persisted
object(s) to the result property of the options.res argument, otherwise sends a 400 BAD REQUEST response to the
client.
Parameters
obj
Partial<T>
The object to store in the database.
options
CreateRequestOptions
The options to process the request using.
Returns
Promise<ClientMongo>
Inherited from
BaseOAuthClientRoute.doCreateObject
doDelete()
protecteddoDelete(id,options):Promise<void>
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:168
Attempts to delete an existing data model object with a given unique identifier encoded by the URI parameter
id.
Parameters
id
string
The unique identifier of the object to delete.
options
DeleteRequestOptions
The options to process the request using.
Returns
Promise<void>
Inherited from
doExists()
protecteddoExists(id,options):Promise<any>
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:175
Attempts to determine if an existing object with the given unique identifier exists.
Parameters
id
string
The unique identifier of the object to verify exists.
options
FindRequestOptions
The options to process the request using.
Returns
Promise<any>
Inherited from
doFind()
protecteddoFind(options):Promise<ClientMongo[]>
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:183
Attempts to retrieve all data model objects matching the given set of criteria as specified in the request
query. Any results that have been found are set to the result property of the res argument. result is
never null.
Parameters
options
FindRequestOptions
The options to process the request using.
Returns
Promise<ClientMongo[]>
Inherited from
doFindById()
protecteddoFindById(id,options):Promise<ClientMongo|null>
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:189
Attempts to retrieve a single data model object as identified by the id parameter in the URI.
Parameters
id
string
options
FindRequestOptions
The options to process the request using.
Returns
Promise<ClientMongo | null>
Inherited from
BaseOAuthClientRoute.doFindById
doTruncate()
protecteddoTruncate(options):Promise<void>
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:196
Attempts to remove all entries of the data model type from the datasource matching the given parameters and query.
Parameters
options
TruncateRequestOptions
The options to process the request using.
Returns
Promise<void>
Inherited from
BaseOAuthClientRoute.doTruncate
doUpdate()
protecteddoUpdate(id,obj,options):Promise<ClientMongo>
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:210
Attempts to modify an existing data model object as identified by the id parameter in the URI.
Parameters
id
string
obj
UpdateObject<ClientMongo>
The object to update in the database
options
UpdateRequestOptions<ClientMongo>
The options to process the request using.
Returns
Promise<ClientMongo>
Inherited from
doUpdateProperty()
protecteddoUpdateProperty(id,propertyName,value,options):Promise<ClientMongo>
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:221
Attempts to modify a single property of an existing data model object as identified by the id parameter in the URI.
Note that this effectively bypasses optimistic locking and can cause unexpected data overwrites. Use with care.
Parameters
id
string
The unique identifier of the object to update.
propertyName
string
The name of the property to update.
value
any
The value of the property to set.
options
UpdateRequestOptions<ClientMongo>
The options to process the request using.
Returns
Promise<ClientMongo>
Inherited from
BaseOAuthClientRoute.doUpdateProperty
exists()
exists(
id,query,res,user?):Promise<any>
Defined in: auth/src/routes/BaseOAuthClientRoute.ts:182
Parameters
id
string
query
any
res
HttpResponse
user?
JWTUser
Returns
Promise<any>
Inherited from
find()
find(
params,query,user?):Promise<ClientMongo[]>
Defined in: auth/src/routes/BaseOAuthClientRoute.ts:200
Client's class-level ACL intentionally does NOT grant LIST to .* — see Secret.find()'s own
doc comment for why a class-level wildcard grant would leak every other caller's clients. Self-service
"list my own clients" is instead handled directly here: scope the query to the caller's own
ownerUid (discarding any client-supplied ownerUid filter, which would otherwise let a caller probe
another owner's clients) and bypass ACL entirely for that already-scoped lookup. A trusted role keeps
the normal, unscoped behavior.
Parameters
params
any
query
any
user?
JWTUser
Returns
Promise<ClientMongo[]>
Inherited from
findById()
findById(
id,query,user?):Promise<ClientMongo|null>
Defined in: auth/src/routes/BaseOAuthClientRoute.ts:219
Parameters
id
string
query
any
user?
JWTUser
Returns
Promise<ClientMongo | null>
Inherited from
regenerateSecret()
regenerateSecret(
id,user?):Promise<{clientSecret:string; }>
Defined in: auth/src/routes/BaseOAuthClientRoute.ts:240
Generates a new secret for a CONFIDENTIAL client, invalidating the previous one, and returns it in
plaintext exactly once — it is never persisted or retrievable again after this response. Subject to
the same ACL as every other mutation on this record: the client's owner, or a trusted role.
Parameters
id
string
user?
JWTUser
Returns
Promise<{ clientSecret: string; }>
Inherited from
BaseOAuthClientRoute.regenerateSecret
truncate()
truncate(
params,query,user?):Promise<void>
Defined in: auth/src/routes/BaseOAuthClientRoute.ts:263
Parameters
params
any
query
any
user?
JWTUser
Returns
Promise<void>
Inherited from
update()
update(
id,obj,req,user?):Promise<ClientMongo>
Defined in: auth/src/routes/BaseOAuthClientRoute.ts:150
Parameters
id
string
obj
UpdateObject<ClientMongo>
req
HttpRequest
user?
JWTUser
Returns
Promise<ClientMongo>
Inherited from
updateBulk()
updateBulk(
obj,req,user?):Promise<ClientMongo[]>
Defined in: auth/src/routes/BaseOAuthClientRoute.ts:268
Parameters
obj
UpdateObject<ClientMongo>[]
req
HttpRequest
user?
JWTUser
Returns
Promise<ClientMongo[]>
Inherited from
BaseOAuthClientRoute.updateBulk
updateProperty()
updateProperty(
id,propertyName,obj,user?):Promise<ClientMongo>
Defined in: auth/src/routes/BaseOAuthClientRoute.ts:273
Parameters
id
string
propertyName
string
obj
any
user?
JWTUser
Returns
Promise<ClientMongo>
Inherited from
BaseOAuthClientRoute.updateProperty
validate()
validate(
objs,options?):Promise<void>
Defined in: auth/node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:225
Calls repoUtils.validate() to validate the object(s) provided.
Parameters
objs
Partial<ClientMongo> | Partial<ClientMongo>[]
options?
CreateRequestOptions | UpdateRequestOptions<ClientMongo>
Returns
Promise<void>
Inherited from
validateCreate()
protectedvalidateCreate(obj,user?):Promise<void>
Defined in: auth/src/routes/BaseOAuthClientRoute.ts:80
Override this function to perform additional custom validation of object creation. This is called
for each object passed to the create() operation.
Parameters
obj
Partial<T>
user?
JWTUser
Returns
Promise<void>
Inherited from
BaseOAuthClientRoute.validateCreate
validateUpdate()
protectedvalidateUpdate(id,obj,user?):Promise<void>
Defined in: auth/src/routes/BaseOAuthClientRoute.ts:127
Override this function to perform additional custom validation of object updates. This is called
for update() and updateBulk() operations. updateBulk() calls this function for each update
object.
Parameters
id
string
obj
UpdateObject<ClientMongo>
user?
JWTUser
Returns
Promise<void>