Skip to content
This repository was archived by the owner on Jun 23, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
196 commits
Select commit Hold shift + click to select a range
0853a29
oidcendpoint in oidcop.
rohe Apr 12, 2021
15e06fa
method key not used.
rohe Apr 12, 2021
05b8887
Simple dict
rohe Apr 12, 2021
4e8e944
Based on Server instead of EndpointContext.
rohe Apr 14, 2021
9a16878
Refactored out create_session in the Authorization endpoint.
rohe Apr 14, 2021
704e724
Fixes.
rohe Apr 14, 2021
9a82b2f
Changed to use Server instead of EndpointContext as base class.
rohe Apr 15, 2021
035331c
Use .hex on uuid4 to get usable value.
rohe Apr 15, 2021
1dbf042
Started to write more documentation.
rohe Apr 18, 2021
0a0dd61
Sorted configuration.
rohe Apr 18, 2021
0e65bed
Editorial
rohe Apr 18, 2021
497c390
oidcop instead of oidcendpoint
rohe Apr 20, 2021
07e6fd4
Rewritten the cookie handling.
rohe Apr 21, 2021
9310222
Updated OP configuration files
rohe Apr 21, 2021
321e79f
Fixed a couple of bugs.
rohe Apr 22, 2021
4209120
Relocated chpy to unsupported until updated.
rohe Apr 23, 2021
8fd24b6
feat: AuthzHandling in default config.json
peppelinux Apr 24, 2021
d178890
fix: cookie create on logout request
peppelinux Apr 25, 2021
d9710c1
Added comprehensive tests for the claims interface.
rohe Apr 26, 2021
d5855cf
Merge branch 'incl_oidcendpoint' of github.com:IdentityPython/oidc-op…
rohe Apr 26, 2021
9236aad
Fixed a couple of unit test issues.
rohe Apr 27, 2021
9eeac94
feat: added support for a pure python dictionary as configuration fil…
peppelinux Apr 27, 2021
f590451
Minor changes
peppelinux Apr 28, 2021
2b74b03
Merge pull request #20 from IdentityPython/incl_oidcendpoint
rohe Apr 28, 2021
6793e3a
fix: django_op example update
peppelinux Apr 29, 2021
20219a5
Merge branch 'master' into pre-dev
peppelinux Apr 29, 2021
b259503
Merge pull request #26 from IdentityPython/pre-dev
Apr 29, 2021
2a52469
fix: pep8 and some bandits ...
peppelinux Apr 29, 2021
7ea5422
Merge branch 'develop' of https://github.com/IdentityPython/oidc-op i…
peppelinux Apr 29, 2021
f3e7380
fix: added jinja2 as dep
peppelinux Apr 29, 2021
756eb4e
fix: added responses as dep
peppelinux Apr 29, 2021
80e9e71
fix: gh actions typo + flake8 max line len
peppelinux Apr 29, 2021
5b8c26b
feat: release-draftes as gh action
peppelinux Apr 29, 2021
f82637c
userinfo setup should not be done here.
rohe Apr 30, 2021
8b6b59c
If request_uri is not supported, don't allow it to used.
rohe Apr 30, 2021
707c741
Merge branch 'develop' of github.com:IdentityPython/oidc-op into develop
rohe Apr 30, 2021
29660ac
feat: abemus documentation, still work in progress
peppelinux Apr 30, 2021
6927018
Merge branch 'develop' of https://github.com/IdentityPython/oidc-op i…
peppelinux Apr 30, 2021
d15a7bd
* chore: http_params explained
peppelinux May 1, 2021
eba6af8
Improving test coverage.
rohe May 2, 2021
6aae3cf
Improving the test coverage. Aiming for 90+.
rohe May 2, 2021
65253b6
Missing file and change in attribute name.
rohe May 2, 2021
25d20a6
Move away from random and into secrets.
rohe May 2, 2021
446e720
chore: more Documentation, less README
peppelinux May 2, 2021
d67decf
Improving code test coverage.
rohe May 4, 2021
3949aa1
Merge branch 'develop' of https://github.com/IdentityPython/oidc-op i…
peppelinux May 4, 2021
1cd22aa
Documentation
peppelinux May 4, 2021
2228a5e
chore: added session_key example
peppelinux May 4, 2021
8c7ecf4
Configurable Client ID generator function
peppelinux May 4, 2021
5f0e79e
fix: client_id_generator switched to default pattern
peppelinux May 4, 2021
679aa35
Merge pull request #27 from IdentityPython/docs
rohe May 5, 2021
b484a00
Merge pull request #29 from IdentityPython/cid_gen
rohe May 5, 2021
271f722
Dobn't do things that are known will fail.
rohe May 5, 2021
bdaca54
Refactored Configuration, insert a Base class.
rohe May 5, 2021
cbf1624
Merge branch 'develop' of github.com:IdentityPython/oidc-op into develop
rohe May 5, 2021
2522b5e
fix: https://github.com/IdentityPython/oidc-op/issues/28
peppelinux May 5, 2021
c0ca909
fix: code linting, removed unused code
peppelinux May 5, 2021
e5f5a78
Refactored Configuration handling.
rohe May 6, 2021
ac2e5bf
Merge branch 'develop' of github.com:IdentityPython/oidc-op into develop
rohe May 6, 2021
89dab9a
Refactored Configuration handling.
rohe May 6, 2021
d3f8874
Fixed tests&bugs
rohe May 6, 2021
c7bc591
Make create_from_config_file work also for direct entity configuratio…
rohe May 7, 2021
0a56f70
Generalized the behavior.
rohe May 7, 2021
ee7a650
Made the flask_op example work.
rohe May 7, 2021
3d3d9e9
Need to be able to dump configuration as dict.
rohe May 7, 2021
12049e6
Error output
rohe May 8, 2021
4f575a3
chore: small and not breakable configure.py refactor
peppelinux May 8, 2021
4d43166
fix: Documentation conf, usage and setup
peppelinux May 8, 2021
b072055
chore: Documentation typo and WiP on diagrams
peppelinux May 8, 2021
71176fd
Rewrote SessionManager to encrypt the session ID as soon as it leaves…
rohe May 11, 2021
ec8c0f3
Merge branch 'develop' of github.com:IdentityPython/oidc-op into develop
rohe May 11, 2021
8ed53c7
chore: against hadoken code
peppelinux May 11, 2021
df9d2f7
Merge pull request #30 from IdentityPython/against_hadoken
rohe May 11, 2021
b4a1786
Define a special load function for issued tokens.
rohe May 11, 2021
b6c0fc4
Merge branch 'develop' of github.com:IdentityPython/oidc-op into develop
rohe May 11, 2021
9d6dd29
Should not property dump and load issued tokens.
rohe May 11, 2021
f11fc39
minor change
peppelinux May 12, 2021
014c9d8
feat: additional check on session db consistency
peppelinux May 14, 2021
50eae15
Merge pull request #35 from IdentityPython/check
rohe May 14, 2021
1e8a14b
Made ID Token a session token.
rohe May 14, 2021
0bbe148
Made ID Token a session token.
rohe May 14, 2021
6aa2539
OOps circular imports. Where did that come from.
rohe May 14, 2021
7bce371
Should be base_claims not default_claims.
rohe May 15, 2021
11a0083
Added token_handler_args default.
rohe May 15, 2021
4d3084f
construct_endpoint_info
peppelinux May 15, 2021
93080b7
JWKs Factory
peppelinux May 15, 2021
8ea3f44
feat: added required access token claims
peppelinux May 14, 2021
a434eeb
merge develop branch
peppelinux May 15, 2021
8238129
Merge branch 'develop' into jwks_factory
May 15, 2021
613cef2
fix: test 00 and code -> map is a primitive, must not be overloaded
peppelinux May 15, 2021
f58958f
chore: flaskop little fix, added two tests with selective token dumps
peppelinux May 15, 2021
88701e7
Against Hadoken code #2
peppelinux May 15, 2021
493a727
Merge pull request #41 from IdentityPython/fix1
rohe May 16, 2021
074b5e3
Merge pull request #43 from IdentityPython/against_hadoken
rohe May 16, 2021
620c148
Merge pull request #42 from IdentityPython/fix-2
rohe May 16, 2021
4ff1ffb
Merge pull request #40 from IdentityPython/base_claims_updated
rohe May 16, 2021
96dd747
Merge pull request #39 from IdentityPython/jwks_factory
rohe May 16, 2021
b7d3914
Merge pull request #38 from IdentityPython/construct_endpoint_info
rohe May 16, 2021
1bfa095
Fixed example configuration.
rohe May 16, 2021
035220f
Editorial and making sure the right token handler is used.
rohe May 16, 2021
062dc1d
Was overwriting configuration.
rohe May 16, 2021
a9f5a5c
Sorry, refactoring code that was left behind.
rohe May 16, 2021
0c65f84
fix: prune all default_claims footprints
peppelinux May 16, 2021
81ff79d
Merge pull request #44 from IdentityPython/fix-3
rohe May 16, 2021
1705ca3
Wrong class by the name of IDToken was imported.
rohe May 16, 2021
2dc8100
Merge branch 'develop' of github.com:IdentityPython/oidc-op into develop
rohe May 16, 2021
7012a26
Long road to coverage
peppelinux May 16, 2021
47a2ea7
Changed the priorities between arguments.
rohe May 17, 2021
580d95e
chore: documentation minor changements
peppelinux May 17, 2021
79ffe89
Make sure base_path is added also when running only OPConfiguration.
rohe May 17, 2021
3d3ddd1
Don't use RSA1_5 unless specifically asked for.
rohe May 17, 2021
6ff3984
Fixed token handler init.
rohe May 17, 2021
9535f7c
Lint doesn't like this.
rohe May 17, 2021
6f804ed
Reference WEAK_ALGS instead of hard coded.
rohe May 18, 2021
d1de529
Removed unnecessary configuration example.
rohe May 18, 2021
944082a
Merge pull request #51 from IdentityPython/cover
rohe May 18, 2021
6f50a4c
Merge pull request #52 from IdentityPython/doc2
rohe May 18, 2021
0366bad
Do less db queries
nsklikas May 12, 2021
ec6ad98
Only handle Token requests in pkce
nsklikas May 12, 2021
80dc00d
ID Token now a session token.
rohe May 18, 2021
7310304
Merge branch 'develop' of github.com:IdentityPython/oidc-op into develop
rohe May 18, 2021
bd8439d
Merge pull request #31 from nsklikas/minor-fixes
rohe May 18, 2021
3a7787c
chore: src/oidcop/token/id_token.py coverage from 86% to 90%
peppelinux May 18, 2021
571ee05
Merge branch 'develop' into doc2
peppelinux May 18, 2021
0bbdf9b
chore: coverage of user_authn.user increased
peppelinux May 18, 2021
02c06a3
fix: adding missing templates
peppelinux May 18, 2021
8dcff31
Doing DPoP.
rohe May 20, 2021
1d0df40
Doing DPoP.
rohe May 20, 2021
1b575f9
Doing DPoP.
rohe May 20, 2021
03916c0
Put the work on device authorization on the backburner.
rohe May 20, 2021
f6adf55
Merge pull request #57 from IdentityPython/device_auth
rohe May 20, 2021
e8b73dc
And finally
rohe May 20, 2021
2332e27
And finally ... working tests.
rohe May 20, 2021
2f7960e
Removed device_authorization.py .
rohe May 20, 2021
6f32610
Merge pull request #54 from IdentityPython/doc2
rohe May 20, 2021
c4081e7
chore: added Oauth2 RAR and DPoP as documentation references
peppelinux May 21, 2021
652a13d
fix: Session dump inconsistent schema after sman flush
peppelinux May 21, 2021
71b324e
fix: session manager gets password from general config
peppelinux May 21, 2021
1d72522
fix: session manager salt optionally from global conf
peppelinux May 21, 2021
0f49fae
Merge pull request #58 from IdentityPython/docs
rohe May 21, 2021
990ada2
some improvements but salt being overwritten runtime with a "" value …
peppelinux May 21, 2021
31975d8
fix: sman has finally made peace with pointers and primary memory is …
peppelinux May 21, 2021
cb28f0e
chore: sman db unit tests, private _key and _salt are readonly values
peppelinux May 22, 2021
ba808dc
fix: .gitignore improved - now salts created by unittests are ignored
peppelinux May 22, 2021
a1b5483
Merge branch 'develop' into sman_flush
peppelinux May 22, 2021
302d17c
chore: Documentation
peppelinux May 22, 2021
b91eb9b
chore: django_op example definitively moved to django-oidc-op github…
peppelinux May 22, 2021
828b075
fix: removed unused imports
peppelinux May 22, 2021
8239376
fix: removed cryptojwt warning
peppelinux May 22, 2021
4286cc8
fix: Added flask_op introspection endpoint in views.py
peppelinux May 23, 2021
3fa0078
chore: Documentation usage examples about consuming Introspection end…
peppelinux May 23, 2021
be43d45
Added token endpoint to oidc-op/oauth2.
rohe May 23, 2021
7a5b8c2
Merge branch 'dpop2' into develop2
peppelinux May 23, 2021
61bde18
fix: removed backburner folder to avoid merge conflicts with future d…
peppelinux May 23, 2021
35c8653
Merge branch 'sman_flush' into develop2
peppelinux May 23, 2021
39fa4e8
Merge branch 'token' into develop2
peppelinux May 23, 2021
4bdc503
Refactored configuration.
rohe May 24, 2021
73c198d
Merge branch 'token' of https://github.com/identitypython/oidc-op int…
peppelinux May 24, 2021
ac79c67
fix: flask_op example config missing comma
peppelinux May 24, 2021
66ad918
Fixed bug
rohe May 24, 2021
d3bfbf0
Added dpop_enabled to endpoint_context.
rohe May 24, 2021
c95a7b3
chore: token handlers description in Documentation
peppelinux May 24, 2021
dc92af0
chore_ pick_auth refactor
peppelinux May 24, 2021
5c6d678
chore: Documentation about login_hint2acr and html templates
peppelinux May 24, 2021
524e4e9
fix: acr value in documentation and examples
peppelinux May 24, 2021
c69fbfc
fix: pick_auth exception
peppelinux May 24, 2021
08c572c
Merge pull request #66 from IdentityPython/pick_auth
May 25, 2021
a01c7c1
Merge pull request #65 from IdentityPython/develop2
peppelinux May 25, 2021
41279c5
fix: session_key configuration paramenter does not exists anymore
peppelinux May 25, 2021
454f894
BREAKAGE: configuration's password, salt and sub_funcs now are under …
peppelinux May 25, 2021
06228af
chore: Documentation session_params and sub_funcs
peppelinux May 25, 2021
8dc7bf0
BREAKAGE: seed param moved from global configuration to registration …
peppelinux May 26, 2021
3d90c15
Merge pull request #72 from IdentityPython/seed
rohe May 26, 2021
eba18ec
Merge pull request #70 from IdentityPython/prune_session_key
peppelinux May 26, 2021
5916dd4
Merge branch 'develop' into session_params
peppelinux May 26, 2021
0fe8067
Merge pull request #71 from IdentityPython/session_params
peppelinux May 26, 2021
662e7d7
First walk through implementing our agreement on token_type, token_sy…
rohe May 28, 2021
5a13dbf
More descriptive name.
rohe May 28, 2021
e993048
Carry token_type to the token minting.
rohe May 28, 2021
9f17870
chore: Readme - still needs a real RTD weblink
peppelinux May 29, 2021
43f938b
fix: typo
peppelinux May 29, 2021
23d6836
fix: typo
peppelinux May 29, 2021
1121ac5
fix: typo
peppelinux May 29, 2021
11914df
Determine which scope to use.
rohe May 30, 2021
184fad7
There might be instances where a based_on token is not connected to t…
rohe May 30, 2021
9ab9737
chore: doc folder moved to docs - according to RTD conf. little chang…
peppelinux May 30, 2021
2f1b388
Merge pull request #75 from IdentityPython/readme
rohe May 30, 2021
b88dff6
Merge pull request #76 from IdentityPython/find_scope
rohe May 30, 2021
011e835
Publish token_type at introspection endpoint.
rohe May 31, 2021
072bfb4
Make id token lifetime configurable
nsklikas May 31, 2021
0af265b
Merge pull request #77 from nsklikas/fix-id-token-lifetime
rohe Jun 1, 2021
043e63d
Merge branch 'develop' into token_type
rohe Jun 1, 2021
afbf9c3
Update grant.py
rohe Jun 1, 2021
aea4b54
Update test_01_grant.py
rohe Jun 1, 2021
3c500b6
Merge pull request #74 from IdentityPython/token_type
rohe Jun 1, 2021
e4d59ab
Merge branch 'master' into develop
rohe Jun 1, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: oidc-op

on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version:
- '3.7'
- '3.8'
- '3.9'

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python setup.py install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 src/oidcop --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 src/oidcop --max-line-length 120 --count --exit-zero --statistics

- name: Test with pytest
run: |
pytest --cov=oidcop tests/
- name: Bandit Security Scan
run: |
bandit --skip B105,B106,B107 -r src/oidcop/
#- name: Upload coverage to Codecov
#uses: codecov/codecov-action@v1
#with:
#token: ${{ secrets.CODECOV_TOKEN }}
#file: example/coverage.xml
#flags: unittests
#env_vars: OS,PYTHON
#name: codecov-umbrella
#fail_ci_if_error: true
#path_to_write_report: ./codecov_report.txt
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
django_op/db.sqlite3
templates
static/
private/
conf.yaml
Expand Down Expand Up @@ -117,3 +115,5 @@ venv.bak/
src/oidcendpoint.egg-info/

.iframes/
tests/pairwise.salt
tests/public.salt
7 changes: 7 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[settings]
force_single_line = 1
known_first_party = oidcop
known_third_party = cryptojwt, oidcmsg
known_future_library = future,past
default_section = THIRDPARTY
line_length = 100
23 changes: 23 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# Build documentation with MkDocs
#mkdocs:
# configuration: mkdocs.yml

# Optionally build your docs in additional formats such as PDF and ePub
formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.8
install:
- requirements: requirements-docs.txt
242 changes: 24 additions & 218 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,233 +1,39 @@
# oidc-op
Examples of a OIDC OPs with CherryPy, Flask and Django.
**NOT** something you should even image running in a production environment.

This project is a Python implementation of an **OIDC Provider** on top of [jwtconnect.io](https://jwtconnect.io/) that shows to you how to 'build' an OP using the classes and functions provided by oidc-op.

### Introduction
If you want to add or replace functionality the official documentation should be able to tell you how.
If you are just going to build a standard OP you only have to understand how to write your configuration file.
In `example/` folder you'll find some complete examples based on flask and django.

This project are here to show you how to 'build' an OP using the
classes and functions provided by oidcendpoint.
Idpy OIDC-op implements the following standards:

If you are just going to build a standard OP you only have to write the
configuration file. If you want to add or replace functionality this document
should be able to tell you how.
* [OpenID Connect Core 1.0 incorporating errata set 1](https://openid.net/specs/openid-connect-core-1_0.html)
* [Web Finger](https://openid.net/specs/openid-connect-discovery-1_0.html#IssuerDiscovery)
* [OpenID Connect Discovery 1.0 incorporating errata set 1](https://openid.net/specs/openid-connect-discovery-1_0.html)
* [OpenID Connect Dynamic Client Registration 1.0 incorporating errata set 1](https://openid.net/specs/openid-connect-registration-1_0.html)
* [OpenID Connect Session Management 1.0](https://openid.net/specs/openid-connect-session-1_0.html)
* [OpenID Connect Back-Channel Logout 1.0](https://openid.net/specs/openid-connect-backchannel-1_0.html)
* [OpenID Connect Front-Channel Logout 1.0](https://openid.net/specs/openid-connect-frontchannel-1_0.html)
* [OAuth2 Token introspection](https://tools.ietf.org/html/rfc7662)

Setting up an OP means making a number if decisions. Like, should the OP support:
It also comes with the following `add_on` modules.

- [Web Finger](https://openid.net/specs/openid-connect-discovery-1_0.html#IssuerDiscovery)
- [dynamic discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig)
- [dynamic client registration](https://openid.net/specs/openid-connect-registration-1_0.html)
* Custom scopes, that extends [OIDC standard ScopeClaims](https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims)
* [Proof Key for Code Exchange by OAuth Public Clients (PKCE)](https://tools.ietf.org/html/rfc7636)
* [OAuth2 RAR](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-rar)
* [OAuth2 DPoP](https://tools.ietf.org/id/draft-fett-oauth-dpop-04.html)

All these are services you can access at endpoints. The total set of endpoints
that this package supports are
The entire project code is open sourced and therefore licensed under the [Apache 2.0](https://en.wikipedia.org/wiki/Apache_License)

- webfinger
- provider_info
- registration
- authorization
- token
- refresh_token
- userinfo
- end_session
For any futher information please read the [Official Documentation](#TODO).


### Configuration directives
# Contribute

[Join in](https://idpy.org/contribute/).

_issuer_

The issuer ID of the OP, unique value.
# Authors

_capabilities_

This covers most of the basic functionality of the OP. The key words are the
same as defined in
https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata .
A couple of things are defined else where. Like the endpoints, issuer id,
jwks_uri and the authentication methods at the token endpoint.

An example:

response_types_supported:
- code
- token
- id_token
- "code token"
- "code id_token"
- "id_token token"
- "code id_token token"
- none
response_modes_supported:
- query
- fragment
- form_post
subject_types_supported:
- public
- pairwise
grant_types_supported:
- authorization_code
- implicit
- urn:ietf:params:oauth:grant-type:jwt-bearer
- refresh_token
claim_types_supported:
- normal
- aggregated
- distributed

claims_parameter_supported: True
request_parameter_supported: True
request_uri_parameter_supported: True
frontchannel_logout_supported: True
frontchannel_logout_session_supported: True
backchannel_logout_supported: True
backchannel_logout_session_supported: True
check_session_iframe: https://127.0.0.1:5000/check_session_iframe


_id_token_

Defines which class that handles creating an ID Token and possibly also
arguments used when initiating that class.

An example:

id_token:
class: oidcendpoint.id_token.IDToken
kwargs:
default_claims:
email:
essential: True
email_verified:
essential: True


### OIDC Provider example setup

Create an environment
````
virtualenv -ppython3 env
source env/bin/activate
````

##### Install oidc-op
````
pip install git+https://github.com/rohe/oidc-op.git

# get the usage examples
git clone https://github.com/rohe/oidc-op.git
````

##### Configure a Django OP

See

https://github.com/peppelinux/django-oidc-op

##### Configure a Flask OP

````
pip install flask
cd oidc-op/

# configuration: create a private folder
cp -R flask_op/private .

# copy required files
cp flask_op/passwd.json private/
cp flask_op/conf.yaml private/
cp -R flask_op/templates .

# create a JWK for cookie signing
jwkgen --kty=SYM --kid cookie > private/cookie_sign_jwk.json
````

##### About JWK Set (JWKS) files
see: https://cryptojwt.readthedocs.io/en/latest/keyhandling.html

You can use `cryptojwt.key_jar.init_key_jar` to create JWKS file.
An easy way can be to configure the auto creation of JWKS files directly in your conf.yaml file.
Using `read_only: False` in `OIDC_KEYS` it will create the path within the JWKS files.
Change it to `True` if you don't want to overwrite them on each execution.

````
# in conf.yaml
#
OIDC_KEYS:
'private_path': './private/jwks.json'
'key_defs': *keydef
'public_path': './static/jwks.json'
# this will create the jwks files if they absent
'read_only': False
````

In the JWTConnect-Python-CryptoJWT distribution there is also a script you can use to construct a JWK.

You can for instance do:
````
$ jwkgen --kty=RSA
{
"d": "b9ucfay9vxDvz_nRZMVSUR9eRvHNMo0tc8Bl7tWkwxTis7LBXxmbMH1yzLs8omUil_u2a-Z_6VlKENxacuejYYcOhs6bfaU3iOqJbGi2p4t2i1oxjuF-cX6BZ5aHB5Wfb1uTXXobHokjcjVVDmBr_fNYBEPtZsVYqyN9sR9KE_ZLHEPks3IER09aX9G3wiB_PgcxQDRAl72qucsBz9_W9KS-TVWs-qCEqtXLmx9AAN6P8SjUcHAzEb0ZCJAYCkVu34wgNjxVaGyYN1qMA-1iOOVz--wtMyBwc5atSDBDgUApxFyj_DHSeBl81IHedcPjS9azxqFhumP7oJJyfecfSQ",
"e": "AQAB",
"kid": "cHZQbWRrMzRZak53U1pfSUNjY0dKd2xXaXRKenktdUduUjVBVTl3VE5ndw",
"kty": "RSA",
"n": "73XCXV2iiubSCEaFe26OpVnsBFlXwXh_yDCDyBqFgAFi5WdZTpRMJZoK0nn_vv2MvrXqFnw6IfXkwdsRGlMsNldVy36003gKa584CNksxfenwJZcF-huASUrSJEFr-3c0fMT_pLyAc7yf3rNCdRegzbBXSvIGKQpaeIjIFYftAPd9tjGA_SuYWVQDsSh3MeGbB4wt0lArAyFZ4f5o7SSxSDRCUF3ng3CB_QKUAaDHHgXrcNG_gPpgqQZjsDJ0VwMXjFKxQmskbH-dfsQ05znQsYn3pjcd_TEZ-Yu765_L5uxUrkEy_KnQXe1iqaQHcnfBWKXt18NAuBfgmKsv8gnxQ",
"p": "_RPgbiQcFu8Ekp-tC-Kschpag9iaLc9aDqrxE6GWuThEdExGngP_p1I7Qd7gXHHTMXLp1c4gH2cKx4AkfQyKny2RJGtV2onQButUU5r0gwnlqqycIA2Dc9JiH85PX2Z889TKJUlVETfYbezHbKhdsazjjsXCQ6p9JfkmgfBQOXM",
"q": "8jmgnadtwjMt96iOaoL51irPRXONO82tLM2AAZAK5Obsj23bZ9LFiw2Joh5oCSFdoUcRhbbIhCIv2aT4T_XKnDGnddrkxpF5Xgu0-hPNYnJx5m4kuzerot4j79Tx6qO-bshaaGz50MHs1vHSeFaDVN4fvh_hDWpV1BCNI0PKK-c"
}
SHA-256: pvPmdk34YjNwSZ_ICccGJwlWitJzy-uGnR5AU9wTNgw
````


##### Run the server
````
python -m flask_op.server private/conf.yaml
````

Then open your browser to `https://127.0.0.1:5000/.well-known/openid-configuration` to get the OpenID Provider Configuration resource.


##### Install OidcRP and configure flask-rp

It uses `JWTConnect-Python-OidcRP` as Relaing Party for tests, see [related page](https://github.com/openid/JWTConnect-Python-OidcRP).
You can run a working instance of `JWTConnect-Python-OidcRP.flask_rp` with:

````
pip install git+https://github.com/openid/JWTConnect-Python-OidcRP.git

# get entire project to have examples files
git clone https://github.com/openid/JWTConnect-Python-OidcRP.git
cd JWTConnect-Python-OidcRP

# run it as it come
python3 -m flask_rp.wsgi flask_rp/conf.yaml

# if you use django_op
RP_LOGFILE_NAME="./flrp.django.log" python3 -m flask_rp.wsgi django_op/example/data/oidc_rp/conf.django.yaml
````

Now you can connect to `https://127.0.0.1:8090/` to see the RP landing page and select your authentication endpoint.


### Authentication examples

![RP](doc/images/1.png)

Get to the RP landing page to choose your authentication endpoint. The first option aims to use _Provider Discovery_.

----------------------------------

![OP Auth](doc/images/2.png)

AS/OP accepted our authentication request and prompt to us the login form. Read passwd.json file to get credentials.

----------------------------------

![Access](doc/images/3.png)

The identity representation with the information fetched from the user info endpoint.

----------------------------------

![Logout](doc/images/4.png)

We can even test the single logout
- Roland Hedberg
32 changes: 0 additions & 32 deletions chpy/private/jwks.json

This file was deleted.

1 change: 0 additions & 1 deletion chpy/static/jwks.json

This file was deleted.

Loading