forked from netbox-community/netbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes netbox-community#12226: Add Profile Data Headers to Remote Aut…
…hentication Middleware
- Loading branch information
1 parent
c1c98f9
commit cd9f53e
Showing
6 changed files
with
66 additions
and
1 deletion.
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
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 |
---|---|---|
|
@@ -151,6 +151,29 @@ def test_remote_auth_custom_header(self): | |
self.assertEqual(int(self.client.session.get( | ||
'_auth_user_id')), self.user.pk, msg='Authentication failed') | ||
|
||
@override_settings( | ||
REMOTE_AUTH_ENABLED=True, | ||
LOGIN_REQUIRED=True | ||
) | ||
def test_remote_auth_user_profile(self): | ||
""" | ||
Test remote authentication with user profile details. | ||
""" | ||
headers = { | ||
'HTTP_REMOTE_USER': 'remoteuser1', | ||
'HTTP_REMOTE_USER_FIRST_NAME': 'John', | ||
'HTTP_REMOTE_USER_LAST_NAME': 'Smith', | ||
'HTTP_REMOTE_USER_EMAIL': '[email protected]', | ||
} | ||
|
||
response = self.client.get(reverse('home'), follow=True, **headers) | ||
self.assertEqual(response.status_code, 200) | ||
|
||
self.user = User.objects.get(username='remoteuser1') | ||
self.assertEqual(self.user.first_name, "John", msg='User first name was not updated') | ||
self.assertEqual(self.user.last_name, "Smith", msg='User last name was not updated') | ||
self.assertEqual(self.user.email, "[email protected]", msg='User email was not updated') | ||
|
||
@override_settings( | ||
REMOTE_AUTH_ENABLED=True, | ||
REMOTE_AUTH_AUTO_CREATE_USER=True, | ||
|