Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
test_oauth2_django
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
test-it
test_oauth2_django
Commits
1758b6fd
Commit
1758b6fd
authored
Nov 06, 2017
by
Sharad Heft
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the README.
parent
b0347c60
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
1 deletion
+45
-1
README.md
README.md
+45
-1
No files found.
README.md
View file @
1758b6fd
...
...
@@ -17,8 +17,52 @@ add a URL entry for the authentication application:
## Settings
There are some additional settings you should add to your Django settings file
but they're pretty self-explanatory:
about your OAuth2 client
but they're pretty self-explanatory:
*
`TEST_OAUTH_CLIENT_ID`
: The client ID of your TEST OAuth2 app.
*
`TEST_OAUTH_CLIENT_SECRET`
: The client secret of your app.
*
`TEST_OAUTH_CLIENT_CALLBACK`
: The _exact_ callback URI of your app.
Some other options are more interesting:
*
`TEST_OAUTH_CREATE_GROUPS`
: Create Django groups whenever a user logs into
your app.
*
`TEST_OAUTH_CREATE_CHARACTERS`
: Same as above, but creates a Character for
each of the alts of the person logging in.
*
`TEST_OAUTH_REDIRECT`
: The URL to which people are redirected after loggin
in or out of the app.
*
`TEST_OAUTH_VERIFIERS`
: See below.
### Verifiers
You can use an iterable of
`Verifier`
objects to confirm that people logging
into your app conform to some requirement. For example, take the following
verifier class:
class GroupMembershipVerifier(Verifier):
message = "You are not in the correct groups to log in to this site."
def valid(self, groups, **kwargs):
for g in groups:
if g['id'] == self.group:
return True
return False
You may then use this verifier as follows:
TEST_OAUTH_VERIFIERS = [
verifiers.GroupMembershipVerifier(group=10000)
]
Which will deny any member not in group 10000. A login is denied if any of the
verifiers return false. So, you may also do something like this:
TEST_OAUTH_VERIFIERS = [
verifiers.GroupMembershipVerifier(group=10000),
verifiers.GroupMembershipVerifier(group=1111),
verifiers.TESTMembershipVerifier(),
]
You can write your own verifiers as well. Just look at the source code for
examples.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment