Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 9cec2dc

Browse files
committed
Documentation
2 parents c311a6a + 7471115 commit 9cec2dc

File tree

1 file changed

+40
-25
lines changed

1 file changed

+40
-25
lines changed

doc/source/rp_handler.rst

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ and OAuth2 Authorization Server instead. There are some differences
2828
in the details between the two sets but overall the entities work much the same
2929
way.
3030

31-
OAuth2 and thereby OpenID Connect (OIDC) are build on a request-response paradigm.
31+
OAuth2 and thereby OpenID Connect (OIDC) are built on a request-response paradigm.
3232
The RP issues a request and the OP returns a response.
3333

3434
The OIDC core standard defines a set of such request-responses.
@@ -43,12 +43,12 @@ occur:
4343
6. User info
4444

4545
When a user accessing the web service for some reason needs to be authenticate
46-
or the service needs a access token that allows it to access some resources
46+
or the service needs an access token that allows it to access some resources
4747
at a resource service on behalf of the user a number of things will happen:
4848

4949
Find out which OP to talk to.
5050
If the RP handler is configured to only communicate to a defined set of OPs
51-
then the user is probable presented a list to chose from.
51+
then the user is probable presented a list to choose from.
5252
If the OP the user wants to authenticated at is unknown to the RP Handler
5353
it will use some discovery service to, given some information provided by
5454
the user, find out where to learn more about the OP.
@@ -62,7 +62,7 @@ Gather information about the OP
6262
provider info discovery service provided by OIDC.
6363

6464
Register the client with the OP
65-
Again this can be done beforehand or it can be done on-the-fly when needed.
65+
Again, this can be done beforehand or it can be done on-the-fly when needed.
6666
If it's done before you will have to use a registration service provided by
6767
the organization responsible for the OP.
6868
If it's to be done on-the-fly you will have to use the dynamic client
@@ -103,8 +103,8 @@ Microsoft
103103
done manual. What it comes down to is that you will only need services
104104
2 and 4.
105105

106-
Github
107-
Now, to begin with Github is not running an OP they basically have an
106+
GitHub
107+
Now, to begin with GitHub is not running an OP they basically have an
108108
Oauth2 AS with some additions. It doesn't support dynamic provider info
109109
discovery or client registration. If expects response_type to be *code*
110110
so services 4,5 and 6 are needed.
@@ -124,7 +124,7 @@ authorization/authentication for one user starting with the authorization reques
124124
Tier 1 API
125125
----------
126126

127-
The high level methods you have access to (in the order they are to be
127+
The high-level methods you have access to (in the order they are to be
128128
used) are:
129129

130130
:py:meth:`oidcrp.RPHandler.begin`
@@ -150,7 +150,7 @@ like this::
150150

151151
state=Oh3w3gKlvoM2ehFqlxI3HIK5&scope=openid&code=Z0FBQUFBQmFkdFFjUVpFWE81SHU5N1N4N01&iss=https%3A%2F%2Fexample.org%2Fop&client_id=zls2qhN1jO6A
152152

153-
After the RP has recieved this response the processing continues with:
153+
After the RP has received this response the processing continues with:
154154

155155
:py:meth:`oidcrp.RPHandler.get_session_information`
156156
In the authorization response there MUST be a state parameter. The value
@@ -173,8 +173,8 @@ After the RP has recieved this response the processing continues with:
173173
Tier 2 API
174174
----------
175175

176-
The tier 1 API is good for getting you started with authenticating an user and
177-
getting user information but if you're look at a long term engagement you need
176+
The tier 1 API is good for getting you started with authenticating a user and
177+
getting user information but if you're look at a long-term engagement you need
178178
a finer grained set of methods. These I call the tier 2 API:
179179

180180
:py:meth:`oidcrp.RPHandler.do_provider_info`
@@ -239,15 +239,15 @@ authorization request and accepted by the user.
239239
response will be True or False depending in the state of the authentication.
240240

241241
:py:meth:`oidcrp.RPHandler.get_valid_access_token`
242-
When you are issued a access token they normally comes with a life time.
242+
When you are issued a access token it normally comes with a life time.
243243
After that time you are expected to use the refresh token to get a new
244-
access token. There are 2 ways of finding out if the access token you have
245-
passed their life time. You can use this method or you can just try using
244+
access token. There are 2 ways of finding out if the access token you have is
245+
past its life time. You can use this method or you can just try using
246246
the access token and see what happens.
247247

248-
Now, if you use this method and it tells you you have an access token
249-
that should still be usable. That is no guarantee that that is the case.
250-
things may have happened on the OPs side that makes the access token
248+
Now, if you use this method and it tells you that you have an access token
249+
that should still be usable, that is no guarantee it is still usable.
250+
Things may have happened on the OPs side that makes the access token
251251
invalid. So if this method only returns a hint as to the usability of the
252252
access token.
253253

@@ -339,6 +339,22 @@ redirect_uris
339339
the use back to this URL after the authorization/authentication has
340340
completed. These URLs should be OP/AS specific.
341341

342+
behavior
343+
Information about how the RP should behave towards the OP/AS
344+
345+
rp_keys
346+
If the OP doesn't support dynamic provider discovery it may still want to
347+
have a way of distributing keys that allows it to rotate them at anytime.
348+
To accomplish this some providers have chosen to publish a URL to where
349+
you can find their OPs key material in the form of a JWKS.
350+
351+
Usage example::
352+
353+
'keys': {'url': {<issuer_id> : <jwks_url>}}
354+
355+
356+
If the provider info discovery is done dynamically you need this
357+
342358
client_preferences
343359
How the RP should prefer to behave against the OP/AS
344360

@@ -420,7 +436,6 @@ return the user info at the userinfo endpoint::
420436
}
421437

422438

423-
424439
----------------------------
425440
RP configuration - Microsoft
426441
----------------------------
@@ -490,10 +505,10 @@ there. And in this case this is it. All the user info will be included in the
490505

491506

492507
-------------------------
493-
RP configuration - Github
508+
RP configuration - GitHub
494509
-------------------------
495510

496-
As mentioned before Github runs an OAuth2 AS not an OP.
511+
As mentioned before GitHub runs an OAuth2 AS not an OP.
497512
Still we can talk to it using this configuration::
498513

499514
{
@@ -522,15 +537,15 @@ Still we can talk to it using this configuration::
522537
}
523538

524539
Part by part.
525-
Like with Google and Microsoft, Github expects you to register your client in
526-
advance. You register teh redirect_uris and in return will get *client_id* and
540+
Like with Google and Microsoft, GitHub expects you to register your client in
541+
advance. You register the redirect_uris and in return will get *client_id* and
527542
*client_secret*::
528543

529544
'client_id': 'eeeeeeeee',
530545
'client_secret': 'aaaaaaaaaaaaa',
531546
"redirect_uris": ["{}/authz_cb/github".format(BASEURL)],
532547

533-
Since Github doesn't support dynamic provder info discovery you have to enter
548+
Since GitHub doesn't support dynamic provder info discovery you have to enter
534549
that information in the configuration::
535550

536551
"issuer": "https://github.com/login/oauth/authorize",
@@ -543,7 +558,7 @@ that information in the configuration::
543558
"https://api.github.com/user"
544559
},
545560

546-
Regarding the client behaviour the Github AS expects response_type *code*.
561+
Regarding the client behaviour the GitHub AS expects response_type *code*.
547562
The number of scope values is rather large I've just chose 2 here.
548563
No client authentication at the token endpoint is expected::
549564

@@ -556,9 +571,9 @@ No client authentication at the token endpoint is expected::
556571
And about services, *Authorization* as always, *AccessToken* to convert the
557572
received *code* in the authorization response into an access token which later
558573
can be used to access user info at the userinfo endpoint.
559-
Github deviates from the standard in a number of way. First the Oauth2
574+
GitHub deviates from the standard in a number of way. First the Oauth2
560575
standard doesn't mention anything like an userinfo endpoint, that is OIDC.
561-
So Github has implemented something that is inbetween OAuth2 and OIDC.
576+
So GitHub has implemented something that is in between OAuth2 and OIDC.
562577
What's more disturbing is that the accesstoken response by default is not
563578
encoded as a JSON document which the standard say but instead it's
564579
urlencoded. Lucky for us, we can deal with both these things by configuration

0 commit comments

Comments
 (0)