Commit 1758b6fd authored by Sharad Heft's avatar Sharad Heft

Update the README.

parent b0347c60
...@@ -17,8 +17,52 @@ add a URL entry for the authentication application: ...@@ -17,8 +17,52 @@ add a URL entry for the authentication application:
## Settings ## Settings
There are some additional settings you should add to your Django settings file 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_ID`: The client ID of your TEST OAuth2 app.
* `TEST_OAUTH_CLIENT_SECRET`: The client secret of your app. * `TEST_OAUTH_CLIENT_SECRET`: The client secret of your app.
* `TEST_OAUTH_CLIENT_CALLBACK`: The _exact_ callback URI 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.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment