urbanplatform / django-keycloak-auth

Middleware to allow authorization using Keycloak and Django for django-rest-framework (DRF). This package should only be used in projects starting from scratch, since it overrides the users' management.
MIT License
32 stars 14 forks source link

Improve Readme #36

Closed TomasLopes1998 closed 1 year ago

TomasLopes1998 commented 1 year ago

1st suggestion

When using GraphQL the middleware must only be declared in the GRAPHENE setting

image

and so, not declared in the MIDDLEWARE

image

2nd suggestion

after version 1.1.1 add in the KEYCLOAK_CONFIG -> 'DECODE_TOKEN': True

KEYCLOAK_CONFIG = {
    'SERVER_URL': '<PUBLIC_SERVER_URL>',
    'INTERNAL_URL': '<INTERNAL_SERVER_URL>', # Optional: Default is SERVER_URL
    'BASE_PATH': '', # Optional: Default matches Keycloak's default '/auth'
    'REALM': '<REALM_NAME>',
    'CLIENT_ID': '<CLIENT_ID>',
    'CLIENT_SECRET_KEY': '<CLIENT_SECRET_KEY>',
    'CLIENT_ADMIN_ROLE': '<CLIENT_ADMIN_ROLE>',
    'REALM_ADMIN_ROLE': '<REALM_ADMIN_ROLE>',
    'EXEMPT_URIS': [],  # URIS to be ignored by the package
    'GRAPHQL_ENDPOINT': 'graphql/',  # Default graphQL endpoint
    'DECODE_TOKEN': True # **!!!ADDED!!!**
}
diogosilva30 commented 1 year ago

Hello @TomasLopes1998. Thanks for your suggestions, they are highly appreciated. Our team is currently working towards a new release (v2), and we will include your suggestions and provide more comprehensive documentation. As such, I'm closing this issue. Feel free to reach out with further suggestions or bugs.