Castlecraft extensions for frappe microservice development.
It requires Authorization Server with following features:
- Token Introspection Endpoint
After installation of this app, request to frappe app can be made using access_token
generated by central server.
Note: Works on version 13 onwards.
bench get-app castlecraft https://gitlab.com/castlecraft/cfe.git
bench --site <site-name> install-app castlecraft
Make following changes in site_config.json
as per your setup:
{
...
"castlecraft_auth_header_enabled": 1,
"castlecraft_auth_introspect_bearer_enabled": 1,
"castlecraft_client_id": "client_id_or_allowed_aud_claim",
"castlecraft_client_secret": "client_secret",
"castlecraft_create_user_on_auth_enabled": 1,
"castlecraft_introspect_token_key": "access_token",
"castlecraft_introspect_url": "https://accounts.example.com/oauth2/introspection",
"castlecraft_userinfo_url": "https://accounts.example.com/oauth2/profile",
...
}
castlecraft_auth_header_enabled
: When set to1
, token is introspection endpoint uses basic auth withclient_id
andclient_secret
.castlecraft_auth_introspect_bearer_enabled
: When set to1
, token is introspected to validate user.castlecraft_client_id
: Registeredclient_id
.castlecraft_client_secret
: Registeredclient_secret
.castlecraft_create_user_on_auth_enabled
: When set to1
, user with no roles will be created if not found in system.castlecraft_introspect_token_key
: Key used to pass token to introspection endpoint. Defaults totoken
. Example request will havetoken=abc123
.castlecraft_introspect_url
: Token introspection url.castlecraft_userinfo_url
: User info url.
Copyright 2021 Castlecraft Ecommerce Pvt. Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.