@travetto/auth-web 6.0.0 → 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -251,7 +251,7 @@ This implementation is not suitable for production, but shows the general patter
251
251
  ## Endpoint Decoration
252
252
  [@Login](https://github.com/travetto/travetto/tree/main/module/auth-web/src/decorator.ts#L13) integrates with middleware that will authenticate the user as defined by the specified providers, or throw an error if authentication is unsuccessful.
253
253
 
254
- [@Logout](https://github.com/travetto/travetto/tree/main/module/auth-web/src/decorator.ts#L48) integrates with middleware that will automatically deauthenticate a user, throw an error if the user is unauthenticated.
254
+ [@Logout](https://github.com/travetto/travetto/tree/main/module/auth-web/src/decorator.ts#L56) integrates with middleware that will automatically deauthenticate a user, throw an error if the user is unauthenticated.
255
255
 
256
256
  **Code: Using provider with endpoints**
257
257
  ```typescript
@@ -287,7 +287,7 @@ export class SampleAuth {
287
287
  }
288
288
  ```
289
289
 
290
- [@Authenticated](https://github.com/travetto/travetto/tree/main/module/auth-web/src/decorator.ts#L25) and [@Unauthenticated](https://github.com/travetto/travetto/tree/main/module/auth-web/src/decorator.ts#L37) will simply enforce whether or not a user is logged in and throw the appropriate error messages as needed. Additionally, the [Principal](https://github.com/travetto/travetto/tree/main/module/auth/src/types/principal.ts#L7) is accessible as a resource that can be exposed as a [@ContextParam](https://github.com/travetto/travetto/tree/main/module/web/src/decorator/param.ts#L61) on an [@Injectable](https://github.com/travetto/travetto/tree/main/module/di/src/decorator.ts#L29) class.
290
+ [@Authenticated](https://github.com/travetto/travetto/tree/main/module/auth-web/src/decorator.ts#L29) and [@Unauthenticated](https://github.com/travetto/travetto/tree/main/module/auth-web/src/decorator.ts#L45) will simply enforce whether or not a user is logged in and throw the appropriate error messages as needed. Additionally, the [Principal](https://github.com/travetto/travetto/tree/main/module/auth/src/types/principal.ts#L7) is accessible as a resource that can be exposed as a [@ContextParam](https://github.com/travetto/travetto/tree/main/module/web/src/decorator/param.ts#L61) on an [@Injectable](https://github.com/travetto/travetto/tree/main/module/di/src/decorator.ts#L29) class.
291
291
 
292
292
  ## Multi-Step Login
293
293
  When authenticating, with a multi-step process, it is useful to share information between steps. The `authenticatorState` of [AuthContext](https://github.com/travetto/travetto/tree/main/module/auth/src/context.ts#L14) field is intended to be a location in which that information is persisted. Currently only [passport](http://passportjs.org) support is included, when dealing with multi-step logins. This information can also be injected into a web endpoint method, using the [AuthenticatorState](https://github.com/travetto/travetto/tree/main/module/auth/src/types/authenticator.ts#L9) type;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/auth-web",
3
- "version": "6.0.0",
3
+ "version": "6.0.2",
4
4
  "description": "Web authentication integration support for the Travetto framework",
5
5
  "keywords": [
6
6
  "authentication",
@@ -28,11 +28,11 @@
28
28
  "dependencies": {
29
29
  "@travetto/auth": "^6.0.0",
30
30
  "@travetto/config": "^6.0.0",
31
- "@travetto/web": "^6.0.0",
31
+ "@travetto/web": "^6.0.2",
32
32
  "njwt": "^2.0.1"
33
33
  },
34
34
  "peerDependencies": {
35
- "@travetto/test": "^6.0.0"
35
+ "@travetto/test": "^6.0.1"
36
36
  },
37
37
  "peerDependenciesMeta": {
38
38
  "@travetto/test": {
package/src/decorator.ts CHANGED
@@ -14,6 +14,10 @@ export function Login(source: symbol, ...sources: symbol[]): EndpointDecorator {
14
14
  return ControllerRegistry.createInterceptorConfigDecorator(AuthLoginInterceptor, {
15
15
  providers: [source, ...sources],
16
16
  applies: true
17
+ }, {
18
+ responseContext: {
19
+ isPrivate: true
20
+ }
17
21
  });
18
22
  }
19
23
 
@@ -26,7 +30,11 @@ export function Authenticated(permissions: string[] = []): EndpointDecorator {
26
30
  return ControllerRegistry.createInterceptorConfigDecorator(AuthVerifyInterceptor, {
27
31
  state: 'authenticated',
28
32
  permissions,
29
- applies: true
33
+ applies: true,
34
+ }, {
35
+ responseContext: {
36
+ isPrivate: true
37
+ }
30
38
  });
31
39
  }
32
40
 
@@ -46,5 +54,9 @@ export function Unauthenticated(): EndpointDecorator {
46
54
  * @augments `@travetto/auth:Logout`
47
55
  */
48
56
  export function Logout(): EndpointDecorator {
49
- return ControllerRegistry.createInterceptorConfigDecorator(AuthLogoutInterceptor, { applies: true });
57
+ return ControllerRegistry.createInterceptorConfigDecorator(AuthLogoutInterceptor, { applies: true }, {
58
+ responseContext: {
59
+ isPrivate: true
60
+ }
61
+ });
50
62
  }