Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
test-it
test_oauth2_django
Commits
1758b6fd
Commit
1758b6fd
authored
Nov 06, 2017
by
Sharad Heft
Browse files
Update the README.
parent
b0347c60
Changes
1
Hide whitespace changes
Inline
Side-by-side
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