From c524b90e3fbca49e80e925bdcc1f2aac612d775f Mon Sep 17 00:00:00 2001 From: "William P. Riley-Land" Date: Fri, 29 Apr 2016 11:43:23 -0500 Subject: [PATCH 1/2] Improve wording of auth strategy mode/default I found this wording confusing, and noticed other people have as well (e.g. https://github.com/dwyl/hapi-auth-jwt2/issues/137 ). I think the proposed update better reflects when `server.auth.strategy` sets a default strategy for routes. --- API.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API.md b/API.md index 67976a606..e069b6513 100755 --- a/API.md +++ b/API.md @@ -649,7 +649,7 @@ Registers an authentication strategy where: - `name` - the strategy name. - `scheme` - the scheme name (must be previously registered using [`server.auth.scheme()`](#serverauthschemename-scheme)). -- `mode` - if `true`, the scheme is automatically assigned as a required strategy to any route +- `mode` - unless set to `false`, the scheme is automatically assigned as the default strategy for any route without an `auth` config. Can only be assigned to a single server strategy. Value must be `true` (which is the same as `'required'`) or a valid authentication mode (`'required'`, `'optional'`, `'try'`). Defaults to `false`. From c0d261741c61e4e09e4948ebcbfecef2035f681c Mon Sep 17 00:00:00 2001 From: "William P. Riley-Land" Date: Fri, 29 Apr 2016 13:47:31 -0500 Subject: [PATCH 2/2] Reorder wording for clarity. --- API.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/API.md b/API.md index e069b6513..2f9669b19 100755 --- a/API.md +++ b/API.md @@ -649,10 +649,10 @@ Registers an authentication strategy where: - `name` - the strategy name. - `scheme` - the scheme name (must be previously registered using [`server.auth.scheme()`](#serverauthschemename-scheme)). -- `mode` - unless set to `false`, the scheme is automatically assigned as the default strategy for any route - without an `auth` config. Can only be assigned to a single server strategy. Value must be `true` +- `mode` - defaults to `false`. If set, the value must be `true` (which is the same as `'required'`) or a valid authentication mode (`'required'`, `'optional'`, - `'try'`). Defaults to `false`. + `'try'`). If set to a value other than `false`, the scheme is automatically assigned as the default strategy for any route + without an `auth` config. Can only be assigned to a single server strategy. - `options` - scheme options based on the scheme requirements. ```js