grafana/django-saml2-auth

SAML Attributes not passing

Closed this issue · 2 comments

Hello I am a system admin and I'm very green/new to the scene of SAML and Django. Long story short I have an app "mailman" im trying to implement SSO on now I got it setup and working but i noticed that when a new user is created the only info that gets created in the user profile is username and the user shows up as the email for example user@example.com it doesn't fill out the first name last name or email. The other strange thing about this is that in the Attributes Map I put for example
'email': 'urn:oid:12345.4.555.44432' in email one for username etc. Well i tried logging in then i get an error saying that its missing user_id I cannot for the life of me figure out whats wrong. so i ended up plugging in the oid # for email into username as well and it worked but with the results i explained ealier i attempted the same thing but with email commented out and it still worked.. so i dont understand honestly whats wrong.. I tried a workaround with the hooks trying to extract.. the user_id and Im just not versed enough in this to really make heads or tails of whats going on. If anyone could help that would be greatly greatly appreciated. I dont know if this is the correct forum to even put this message in if not then by all means remove my post as i understand this might not be the exact place for this type of discussion thank you for you time and consideration

I keep getting the error Missing user_id but the attribute mapping is correct Ive looked it over a few times

Fixed this issue with the following code i found from another issue posted in here

def post_create_user(user_dict, *args, **kwargs):
user_model = get_user_model()
user_id = user_dict.get(user_model.USERNAME_FIELD)
user = user_model.objects.get(username=user_id)
user.email = user_id
user.username = user_id.split('@')[0]
user.save()

now the challenge is that when a usr exist already its trying to create again rather than seeing the user exist then allowing login