-
-
Notifications
You must be signed in to change notification settings - Fork 767
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: expose client schema invalidate(err, code) to enable customization
- Loading branch information
Showing
3 changed files
with
84 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Allowing HTTP and/or localhost for implicit response type web clients | ||
|
||
- built for version: ^6.15.0 | ||
|
||
> ⚠️ This violates the OIDC Core 1.0 specification. **Its only practical use-case is for development purposes and as such is not recommended | ||
> for any production deployment.** | ||
```js | ||
const { Provider } = require('oidc-provider'); | ||
|
||
const provider = new Provider('http://localhost:3000', { | ||
clients: [ | ||
{ | ||
client_id: 'development-implicit', | ||
application_type: 'web', | ||
token_endpoint_auth_method: 'none', | ||
response_types: ['id_token'], | ||
grant_types: ['implicit'], | ||
redirect_uris: ['http://localhost:3001'], // this fails two regular validations http: and localhost | ||
}, | ||
], | ||
}); | ||
|
||
const { invalidate: orig } = provider.Client.Schema.prototype; | ||
|
||
provider.Client.Schema.prototype.invalidate = function invalidate(message, code) { | ||
if (code === 'implicit-force-https' || code === 'implicit-forbid-localhost') { | ||
return; | ||
} | ||
|
||
orig.call(this, message); | ||
}; | ||
``` | ||
|
||
In addition to this you may also utilize | ||
[extra client metadata](https://github.com/panva/node-oidc-provider/blob/master/docs/README.md#extraclientmetadata) | ||
and only skip these checks for clients in something like a development mode or similar. Again, no | ||
production client should be allowed to skip these validations. |