listTokens method
Future<List<TokenInfo> >
listTokens(
- Session session, {
- required UuidValue? authUserId,
- String? method,
- String? tokenIssuer,
- Transaction? transaction,
override
Lists all TokenInfos matching the given criteria.
If authUserId is provided, only tokens for that user will be listed.
If method is provided, only tokens created with that authentication method will be listed.
If tokenIssuer is provided, only tokens from that specific token manager will be listed.
Implementation
@override
Future<List<TokenInfo>> listTokens(
final Session session, {
required final UuidValue? authUserId,
final String? method,
final String? tokenIssuer,
final Transaction? transaction,
}) async {
if (tokenIssuer != null && tokenIssuer != tokenIssuerName) {
return [];
}
return (await serverSideSessions.listSessions(
session,
authUserId: authUserId,
method: method,
transaction: transaction,
))
.map(
(final element) => TokenInfo(
userId: element.authUserId.toString(),
tokenId: element.id.toString(),
tokenIssuer: tokenIssuerName,
scopes: element.scopeNames.map(Scope.new).toSet(),
method: element.method,
),
)
.toList();
}