oauth/README.md
author durandn
Wed, 05 Oct 2016 14:24:32 +0200
changeset 124 983e72b4bc45
parent 5 4407b131a70e
permissions -rw-r--r--
Added tag 00.00.21 for changeset 15724968d6e6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
     1
# OAuth 2 Server & GED mock client for test and development
1
5f50937893ac Commit work on metaeducation
durandn
parents:
diff changeset
     2
5
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
     3
## INSTALLATION
1
5f50937893ac Commit work on metaeducation
durandn
parents:
diff changeset
     4
2
d5c583f9a035 fixed commited oauth settings + edited tmpls and readme
durandn
parents: 1
diff changeset
     5
use a different virtualenv than the one for the django metaeducation app
d5c583f9a035 fixed commited oauth settings + edited tmpls and readme
durandn
parents: 1
diff changeset
     6
d5c583f9a035 fixed commited oauth settings + edited tmpls and readme
durandn
parents: 1
diff changeset
     7
$ mkvirtualenv mtdc_oauth_env
1
5f50937893ac Commit work on metaeducation
durandn
parents:
diff changeset
     8
$ pip install -r requirements.txt
2
d5c583f9a035 fixed commited oauth settings + edited tmpls and readme
durandn
parents: 1
diff changeset
     9
5
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    10
## CONFIGURATION
2
d5c583f9a035 fixed commited oauth settings + edited tmpls and readme
durandn
parents: 1
diff changeset
    11
d5c583f9a035 fixed commited oauth settings + edited tmpls and readme
durandn
parents: 1
diff changeset
    12
Edit client_settings.py.tmpl and oauth_settings.py.tmpl to match your renkan django app config.
d5c583f9a035 fixed commited oauth settings + edited tmpls and readme
durandn
parents: 1
diff changeset
    13
5
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    14
## RUNNING
2
d5c583f9a035 fixed commited oauth settings + edited tmpls and readme
durandn
parents: 1
diff changeset
    15
d5c583f9a035 fixed commited oauth settings + edited tmpls and readme
durandn
parents: 1
diff changeset
    16
To run the oauth server:
d5c583f9a035 fixed commited oauth settings + edited tmpls and readme
durandn
parents: 1
diff changeset
    17
5
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    18
	$ workon mtdc_oauth_env
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    19
	$ python oauth.py
2
d5c583f9a035 fixed commited oauth settings + edited tmpls and readme
durandn
parents: 1
diff changeset
    20
d5c583f9a035 fixed commited oauth settings + edited tmpls and readme
durandn
parents: 1
diff changeset
    21
To run the GED mock client:
d5c583f9a035 fixed commited oauth settings + edited tmpls and readme
durandn
parents: 1
diff changeset
    22
5
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    23
	$ workon mtdc_oauth_env
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    24
	$ python client.py
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    25
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    26
Oauth server runs on 127.0.0.1:5000
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    27
Mock ged client runs on 127.0.0.1:8000
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    28
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    29
NOTE: OAuth server will expect you to run Renkan django project on 127.0.0.1:8001
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    30
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    31
## GETTING MOCK GED CLIENT ID AND SECRET
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    32
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    33
You need to run oauth.py, then go to 127.0.0.1:500/get-client-credentials .
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    34
The Oauth server will print a JSON with client_id and client_secret that will allow you to complete the client_settings.py
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    35
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    36
## USAGE
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    37
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    38
First of all you must log into the oauth server
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    39
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    40
	127.0.0.1:5000
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    41
	
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    42
Once you are logged, you can visit the mock GED client
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    43
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    44
	127.0.0.1:8000
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    45
	
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    46
You will start an authorization flow that will validate that you are logged into the OAuth server 
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    47
(note: while Itop's server will auto-validate clients, we keep the validation steps for testing and dev as it makes debugging easier)
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    48
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    49
From there you end up on the client's main page, with two links
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    50
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    51
* One of them is a link to a new Renkan that will open in your browser when everything is properly configured (see server/src/metaeducation/README.md to configure the django app), using Authorization Code flow
4407b131a70e adjustments on Oauth server and mock ged client + Readme
durandn
parents: 2
diff changeset
    52
* The other is a link to create a new Renkan from the API endpoint, using client credentials OAuth flow