@gtsc/api-auth-entity-storage-service
Advanced tools
Comparing version 0.0.3-next.63 to 0.0.3-next.64
export * from "./entities/authenticationUser"; | ||
export * from "./models/IEntityStorageAuthenticationProcessorConfig"; | ||
export * from "./models/IAuthCookiePostProcessorConfig"; | ||
export * from "./models/IAuthCookiePreProcessorConfig"; | ||
export * from "./models/IEntityStorageAuthenticationServiceConfig"; | ||
export * from "./processors/entityStorageAuthenticationProcessor"; | ||
export * from "./processors/authCookiePostProcessor"; | ||
export * from "./processors/authCookiePreProcessor"; | ||
export * from "./restEntryPoints"; | ||
@@ -10,1 +12,2 @@ export * from "./routes/entityStorageAuthenticationRoutes"; | ||
export * from "./utils/passwordHelper"; | ||
export * from "./utils/tokenHelper"; |
@@ -11,2 +11,7 @@ /** | ||
/** | ||
* The name of the cookie to use for the token. | ||
* @default access_token | ||
*/ | ||
cookieName?: string; | ||
/** | ||
* The default time to live for the JWT. | ||
@@ -13,0 +18,0 @@ * @default 1440 |
@@ -1,3 +0,3 @@ | ||
import type { ILoginRequest, ILoginResponse } from "@gtsc/api-auth-entity-storage-models"; | ||
import type { IHttpRequestContext, IRestRoute, ITag } from "@gtsc/api-models"; | ||
import type { ILoginRequest, ILoginResponse, ILogoutRequest, IRefreshTokenRequest, IRefreshTokenResponse } from "@gtsc/api-auth-entity-storage-models"; | ||
import type { IHttpRequestContext, INoContentResponse, IRestRoute, IRestRouteResponseOptions, ITag } from "@gtsc/api-models"; | ||
/** | ||
@@ -21,2 +21,18 @@ * The tag to associate with the routes. | ||
*/ | ||
export declare function authenticationLogin(requestContext: IHttpRequestContext, factoryServiceName: string, request: ILoginRequest): Promise<ILoginResponse>; | ||
export declare function authenticationLogin(requestContext: IHttpRequestContext, factoryServiceName: string, request: ILoginRequest): Promise<ILoginResponse & IRestRouteResponseOptions>; | ||
/** | ||
* Logout from the server. | ||
* @param requestContext The request context for the API. | ||
* @param factoryServiceName The name of the service to use in the routes. | ||
* @param request The request. | ||
* @returns The response object with additional http response properties. | ||
*/ | ||
export declare function authenticationLogout(requestContext: IHttpRequestContext, factoryServiceName: string, request: ILogoutRequest): Promise<INoContentResponse & IRestRouteResponseOptions>; | ||
/** | ||
* Refresh the login token. | ||
* @param requestContext The request context for the API. | ||
* @param factoryServiceName The name of the service to use in the routes. | ||
* @param request The request. | ||
* @returns The response object with additional http response properties. | ||
*/ | ||
export declare function authenticationRefreshToken(requestContext: IHttpRequestContext, factoryServiceName: string, request: IRefreshTokenRequest): Promise<IRefreshTokenResponse & IRestRouteResponseOptions>; |
@@ -9,5 +9,5 @@ import type { IAuthentication } from "@gtsc/api-auth-entity-storage-models"; | ||
/** | ||
* Default TTL in minutes 1440 is 24 hours. | ||
* Default TTL in minutes. | ||
*/ | ||
private static readonly _DEFAULT_TTL; | ||
private static readonly _DEFAULT_TTL_MINUTES; | ||
/** | ||
@@ -41,5 +41,19 @@ * Runtime name for the class. | ||
* @param requestContext The context for the request. | ||
* @returns The authentication token for the user. | ||
* @returns The authentication token for the user, if it uses a mechanism with public access. | ||
*/ | ||
login(email: string, password: string, requestContext?: IServiceRequestContext): Promise<string>; | ||
login(email: string, password: string, requestContext?: IServiceRequestContext): Promise<string | undefined>; | ||
/** | ||
* Logout the current user. | ||
* @param token The token to logout, if it uses a mechanism with public access. | ||
* @param requestContext The context for the request. | ||
* @returns Nothing. | ||
*/ | ||
logout(token?: string, requestContext?: IServiceRequestContext): Promise<void>; | ||
/** | ||
* Refresh the token. | ||
* @param token The token to refresh, if it uses a mechanism with public access. | ||
* @param requestContext The context for the request. | ||
* @returns The refreshed token, if it uses a mechanism with public access. | ||
*/ | ||
refresh(token?: string, requestContext?: IServiceRequestContext): Promise<string | undefined>; | ||
} |
@@ -41,7 +41,7 @@ # Class: EntityStorageAuthenticationService | ||
### \_DEFAULT\_TTL | ||
### \_DEFAULT\_TTL\_MINUTES | ||
> `static` `private` `readonly` **\_DEFAULT\_TTL**: `number` = `1440` | ||
> `static` `private` `readonly` **\_DEFAULT\_TTL\_MINUTES**: `number` = `60` | ||
Default TTL in minutes 1440 is 24 hours. | ||
Default TTL in minutes. | ||
@@ -92,3 +92,3 @@ *** | ||
> **login**(`email`, `password`, `requestContext`?): `Promise`\<`string`\> | ||
> **login**(`email`, `password`, `requestContext`?): `Promise`\<`undefined` \| `string`\> | ||
@@ -113,5 +113,5 @@ Perform a login for the user. | ||
`Promise`\<`string`\> | ||
`Promise`\<`undefined` \| `string`\> | ||
The authentication token for the user. | ||
The authentication token for the user, if it uses a mechanism with public access. | ||
@@ -121,1 +121,57 @@ #### Implementation of | ||
`IAuthentication.login` | ||
*** | ||
### logout() | ||
> **logout**(`token`?, `requestContext`?): `Promise`\<`void`\> | ||
Logout the current user. | ||
#### Parameters | ||
• **token?**: `string` | ||
The token to logout, if it uses a mechanism with public access. | ||
• **requestContext?**: `IServiceRequestContext` | ||
The context for the request. | ||
#### Returns | ||
`Promise`\<`void`\> | ||
Nothing. | ||
#### Implementation of | ||
`IAuthentication.logout` | ||
*** | ||
### refresh() | ||
> **refresh**(`token`?, `requestContext`?): `Promise`\<`undefined` \| `string`\> | ||
Refresh the token. | ||
#### Parameters | ||
• **token?**: `string` | ||
The token to refresh, if it uses a mechanism with public access. | ||
• **requestContext?**: `IServiceRequestContext` | ||
The context for the request. | ||
#### Returns | ||
`Promise`\<`undefined` \| `string`\> | ||
The refreshed token, if it uses a mechanism with public access. | ||
#### Implementation of | ||
`IAuthentication.refresh` |
# Function: authenticationLogin() | ||
> **authenticationLogin**(`requestContext`, `factoryServiceName`, `request`): `Promise`\<`ILoginResponse`\> | ||
> **authenticationLogin**(`requestContext`, `factoryServiceName`, `request`): `Promise`\<`ILoginResponse` & `IRestRouteResponseOptions`\> | ||
@@ -23,4 +23,4 @@ Login to the server. | ||
`Promise`\<`ILoginResponse`\> | ||
`Promise`\<`ILoginResponse` & `IRestRouteResponseOptions`\> | ||
The response object with additional http response properties. |
@@ -6,9 +6,12 @@ # @gtsc/api-auth-entity-storage-service | ||
- [AuthenticationUser](classes/AuthenticationUser.md) | ||
- [EntityStorageAuthenticationProcessor](classes/EntityStorageAuthenticationProcessor.md) | ||
- [AuthCookiePostProcessor](classes/AuthCookiePostProcessor.md) | ||
- [AuthCookiePreProcessor](classes/AuthCookiePreProcessor.md) | ||
- [EntityStorageAuthenticationService](classes/EntityStorageAuthenticationService.md) | ||
- [PasswordHelper](classes/PasswordHelper.md) | ||
- [TokenHelper](classes/TokenHelper.md) | ||
## Interfaces | ||
- [IEntityStorageAuthenticationProcessorConfig](interfaces/IEntityStorageAuthenticationProcessorConfig.md) | ||
- [IAuthCookiePreProcessorConfig](interfaces/IAuthCookiePreProcessorConfig.md) | ||
- [AuthCookiePreProcessorConfig](interfaces/AuthCookiePreProcessorConfig.md) | ||
- [IEntityStorageAuthenticationServiceConfig](interfaces/IEntityStorageAuthenticationServiceConfig.md) | ||
@@ -25,2 +28,4 @@ | ||
- [authenticationLogin](functions/authenticationLogin.md) | ||
- [authenticationLogout](functions/authenticationLogout.md) | ||
- [authenticationRefreshToken](functions/authenticationRefreshToken.md) | ||
- [initSchema](functions/initSchema.md) |
@@ -21,2 +21,16 @@ # Interface: IEntityStorageAuthenticationServiceConfig | ||
### cookieName? | ||
> `optional` **cookieName**: `string` | ||
The name of the cookie to use for the token. | ||
#### Default | ||
```ts | ||
access_token | ||
``` | ||
*** | ||
### defaultTtlMinutes? | ||
@@ -23,0 +37,0 @@ |
@@ -5,2 +5,3 @@ { | ||
"loginFailed": "Login failed", | ||
"refreshFailed": "Refresh failed", | ||
"userNotFound": "The user with the specified e-mail could not be found", | ||
@@ -10,3 +11,5 @@ "passwordMismatch": "The password does not match the user's password" | ||
"entityStorageAuthenticationProcessor": { | ||
"initializeFailed": "The JSON Web token authentication processor could not be initialized", | ||
"initializeFailed": "The JSON Web token authentication processor could not be initialized" | ||
}, | ||
"tokenHelper": { | ||
"missing": "The JSON Web token could not be found in the authorization header", | ||
@@ -13,0 +16,0 @@ "invalid": "The JSON Web token signature could not be validated", |
{ | ||
"name": "@gtsc/api-auth-entity-storage-service", | ||
"version": "0.0.3-next.63", | ||
"version": "0.0.3-next.64", | ||
"description": "Auth Entity Storage contract implementation and REST endpoint definitions", | ||
@@ -17,5 +17,5 @@ "repository": { | ||
"dependencies": { | ||
"@gtsc/api-auth-entity-storage-models": "0.0.3-next.63", | ||
"@gtsc/api-core": "0.0.3-next.63", | ||
"@gtsc/api-models": "0.0.3-next.63", | ||
"@gtsc/api-auth-entity-storage-models": "0.0.3-next.64", | ||
"@gtsc/api-core": "0.0.3-next.64", | ||
"@gtsc/api-models": "0.0.3-next.64", | ||
"@gtsc/core": "next", | ||
@@ -22,0 +22,0 @@ "@gtsc/crypto": "next", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
88472
39
1580
+ Added@gtsc/api-auth-entity-storage-models@0.0.3-next.64(transitive)
+ Added@gtsc/api-core@0.0.3-next.64(transitive)
+ Added@gtsc/api-models@0.0.3-next.64(transitive)
- Removed@gtsc/api-auth-entity-storage-models@0.0.3-next.63(transitive)
- Removed@gtsc/api-core@0.0.3-next.63(transitive)
- Removed@gtsc/api-models@0.0.3-next.63(transitive)
Updated@gtsc/api-core@0.0.3-next.64