Comments (5)
Hmm, did you set USER_ADAPTER
:
https://github.com/15five/django-scim2/blob/master/src/django_scim/settings.py#L8-L11
from django-scim2.
Hmm, did you set
USER_ADAPTER
:https://github.com/15five/django-scim2/blob/master/src/django_scim/settings.py#L8-L11
I've used the default values from your adapters.py file:
SCIM_SERVICE_PROVIDER = {
'USER_ADAPTER': 'django_scim.adapters.SCIMUser',
'GROUP_ADAPTER': 'django_scim.adapters.SCIMGroup',
'SERVICE_PROVIDER_CONFIG_MODEL': 'django_scim.models.SCIMServiceProviderConfig',
'NETLOC': 'localhost',
'AUTHENTICATION_SCHEMES': [
{
'type': 'oauth2',
'name': 'OAuth 2',
'description': 'Oauth 2 implemented with bearer token',
'specUri': '',
'documentationUri': '',
'primary': 'true'
},
{
"name": "HTTP Basic",
"description": "Authentication scheme using the HTTP Basic Standard",
"type": "httpbasic"
}
],
'WWW_AUTHENTICATE_HEADER': 'Bearer realm="api"',
}
My user model inherits from AbstractSCIMUserMixin and AbstractUser:
` class User(AbstractUser, AbstractSCIMUserMixin):
email = EmailField(unique=True)
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = []
def __str__(self):
return self.email `
I have noticed that AbstractSCIMUserMixin has the following property:
@property def scim_groups(self): raise exceptions.NotImplementedError
I'm sure that's why I keep receiving a 501 - Not Implemented status, but I'm not sure how to interpret this.
from django-scim2.
This can be closed. I solved this by implementing a custom Group which inherits from AbstractSCIMGroupMixin and django.contrib.auth.models.Group. I've declared a ManyToManyField to this custom group called "groups" in my custom User model. After that I override the scim_groups property in my custom User model and set it to return self.groups:
`
class Group(Group, AbstractSCIMGroupMixin):
def __str__(self):
return self.scim_display_name
class User(AbstractUser, AbstractSCIMUserMixin):
email = EmailField(unique=True)
scim_username = models.CharField(
_('SCIM Username'),
max_length=254,
null=True,
blank=True,
default=None,
unique=True,
db_index=True,
help_text=_("A service provider's unique identifier for the user"),
)
groups = models.ManyToManyField(Group)
@property
def scim_groups(self):
return self.groups
USERNAME_FIELD = 'scim_username'
def __str__(self):
return self.email
`
I'm receiving the correct responses now.
from django-scim2.
Hi Paul,
I wanted to ask if the way I solved this is okay.
There are 2 Group-tables in my DB now, one of which has the SCIM-fields with a pointer ID to the corresponding auth.Group model.
It all seems to be working like I would expect, but wanted to ask your view on this.
Thanks in advance.
from django-scim2.
Hey @Katert, that certainly is an option. We've seen a number of ways of integrating this library with the existing code bases. The setup you've mentioned might even be better for you down the road given its decoupled nature.
from django-scim2.
Related Issues (20)
- Implement get_user_model same as get_group_model HOT 8
- Sorting based on modified field not supported in get_many method HOT 2
- asking for username and password when accessing v2/scim/Users HOT 1
- Unable to Decouple the User Model HOT 4
- Use the django ORM for filters instead of a custom SQL query generator
- Incompatibility with django 4 HOT 2
- Not syncing the group members HOT 5
- userName attribute should be case-insensitive, per the RFC HOT 6
- Unauthorized issues HOT 4
- Support SCIM views with custom authentication mechanisms HOT 4
- Move to Pytest
- Re-creating of users HOT 2
- admin's scim_id was changed. HOT 4
- Support SCIM 1.1 Implementations HOT 1
- Extend custom authentication mechanisms to authenticate by request. HOT 2
- Why is `get_queryset_post_processor` not applied to querysets in `_search`? HOT 1
- GitHub Sponsor HOT 8
- ModuleNotFoundError: No module named 'django_scim' HOT 2
- Decouple User model from SCIM attributes? HOT 3
- Filters don't apply to reverse foreign keys.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-scim2.