Skip to content

Commit

Permalink
Merge pull request #35 from rohe/updated_policy_handling
Browse files Browse the repository at this point in the history
Updated policy handling
  • Loading branch information
rohe authored May 14, 2024
2 parents 2925fc4 + fb7f875 commit ff58301
Show file tree
Hide file tree
Showing 48 changed files with 2,396 additions and 969 deletions.
231 changes: 231 additions & 0 deletions setup_federation/README_identity.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
########################################
OpenID federation as Identity Federation
########################################

The federation consists of the following entities:

* trust anchor
* trust mark issuer
* OpenID Connect Provider
* OpenID Relying Party

In this example all the entities are running on the same machine.
It is of course not necessary to do so.
If you run the entities on separate machines you have to move the necessary
files inbetween them. You also have to change **entity_id**, **port** and **domain**
in the relevant conf.json file.

Start by setting up the trust anchor.

Trust Anchor
------------

The configuration of the trust anchor can be found in the *trust_anchor* directory.
Consists of two files

* conf.json
The configuration of the entitys components
* views.py
The webserver's (Flask) interface configuration

The existence of those two file with exactly those names are necessary for this
to work.

To start running the trust anchor you have to do::

./entity.py trust_anchor

This will create a number of things in the *trust_anchor* directory

* private
Where the JWKS representation of the private federation keys are kept
* static
Where the JWKS representation of the public federation keys are kept
* subordinate
A directory where information about subordinates are to be kept
* trust_mark_issuers
A directory where information about trust mark issuers are kept.
* debug.log
A log file

All entities in the federation has to have some information about the
trust mark. The information to pass along is collected by doing::

./get_info.py -k -t https://127.0.0.1:7003 > trust_anchor.json

This must be done while the Trust anchor is running.
Of course if you have changed the entity_id of the trust anchor from
https://127.0.0.1:7003 to something else you have to change this command accordingly.

Now you're done with phase 1 concerning the trust anchor. So you can
kill that process for the time being.

Trust Mark Issuer
-----------------

To start running the trust mark issuer you have to do::

./entity.py trust_mark_issuer

A slightly different set of files/directories has been added

* private
Where the JWKS representation of the private federation keys are kept
* static
Where the JWKS representation of the public federation keys are kept
* trust_anchors
A directory where information about trust anchors are kept
* authority_hints
A file containing entity_ids of this entity's authority hints.
Note that there is also a authority_hints.lock file present you can safely
ignore it.
* debug.log
A log file

Now four things have to happen::

1. Adding information about trust anchors
2. Add authority hints
3. Add information about the trust mark issuer as a subordinate to the trust anchor
4. Add information about the trust mark issuer as a trust mark issuer to the trust anchor.

The first two are simply::

./add_info.py -s trust_anchor.json -t trust_mark_issuer/trust_anchors
echo -e "https://127.0.0.1:7003" >> trust_mark_issuer/authority_hints

The third would look like this::

./get_info.py -k -s https://127.0.0.1:6000 > tmp.json
./add_info.py -s tmp.json -t trust_anchor/subordinates

The fourth is presently done like this (may change in the future)::

./issuer.py trust_mark_issuer > tmp.json
./add_info.py -s tmp.json -t trust_anchor/trust_mark_issuers

That should do it for the trust mark issuer.
If you now restart it it should have all the necessary information to be part of the federation.

**Note** The same goes for these commands as was noted above. If you change the
entity_id of the trust anchor or the trust mark issuer you have to change the
command parameters accordingly.

OpenID Connect Provider
-----------------------

Much the same as for the trust mark issuer.
To start running the wallet provider you have to do::

./entity.py openid_provider

A slightly different set of files/directories has been added

* private
Where the JWKS representation of the private federation keys are kept
* static
Where the JWKS representation of the public federation keys are kept
* trust_anchors
A directory where information about trust anchors are kept
* authority_hints
A file containing entity_ids of this entity's authority hints.
Note that there is also a authority_hints.lock file present you can safely
ignore it.
* debug.log
A log file

Now four things have to happen::

1. Adding information about trust anchors
2. Add authority hints
3. Add information about the wallet provider as a subordinate to the trust anchor

The first two are simply::

./add_info.py -s trust_anchor.json -t wallet_provider/trust_anchors
echo -e "https://127.0.0.1:7003" >> wallet_provider/authority_hints

The third would look like this::

./get_info.py -k -s https://127.0.0.1:4004 > tmp.json
./add_info.py -s tmp.json -t trust_anchor/subordinates


That should do it for the wallet provider.
If you now restart it it should have all the necessary information to be part of the federation.

**Note** The same goes for these commands as was noted above. If you change the
entity_id of the trust anchor or the wallet provider you have to change the
command parameters accordingly.

OpenID Relying Party
--------------------

Much the same as for the openid provider.
To start running the relying party you have to do::

./entity.py relaying_party_explicit

A slightly different set of files/directories has been added

* private
Where the JWKS representation of the private federation keys are kept
* static
Where the JWKS representation of the public federation keys are kept
* trust_anchors
A directory where information about trust anchors are kept
* authority_hints
A file containing entity_ids of this entity's authority hints.
Note that there is also a authority_hints.lock file present you can safely
ignore it.
* debug.log
A log file

Now four things have to happen::

1. Adding information about trust anchors
2. Add authority hints
3. Add information about the wallet provider as a subordinate to the trust anchor

The first two are simply::

./add_info.py -s trust_anchor.json -t relaying_party_explicit/trust_anchors
echo -e "https://127.0.0.1:7003" >> relaying_party_explicit/authority_hints

The third would look like this::

./get_info.py -k -s https://127.0.0.1:4002 > tmp.json
./add_info.py -s tmp.json -t trust_anchor/subordinates


That should do it for the wallet provider.
If you now restart it it should have all the necessary information to be part of the federation.

**Note** The same goes for these commands as was noted above. If you change the
entity_id of the trust anchor or the wallet provider you have to change the
command parameters accordingly.

Finalizing the setup
--------------------

At this point, if you have followed the steps above, you should restart the trust anchor.
I should not be necessary to do so but just in case.


Creating a trust mark for an entity
-----------------------------------

For this the script *create_trust_mark.py* is included.
Typical usage::

./create_trust_mark.py -d trust_mark_issuer -m https://refeds.org/category/personalized -e https://127.0.0.1:4002


usage: create_trust_mark.py [-h] [-d DIR_NAME] [-e ENTITY_ID] [-m TRUST_MARK_ID] ::

options:
-h, --help show this help message and exit
-d DIR_NAME, --dir_name DIR_NAME The directory of the trust mark issuer
-e ENTITY_ID, --entity_id ENTITY_ID The target of the Trust Mark
-m TRUST_MARK_ID, --trust_mark_id TRUST_MARK_ID

Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ This must be done while the Trust anchor is running.
Of course if you have changed the entity_id of the trust anchor from
https://127.0.0.1:7003 to something else you have to change this command accordingly.

Now your done with phase 1 concerning the trust anchor. So you can
Now you're done with phase 1 concerning the trust anchor. So you can
kill that process for the time being.

Trust Mark Issuer
Expand Down
3 changes: 3 additions & 0 deletions setup_federation/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def init_app(dir_name, **kwargs) -> Flask:
app = Flask(name, static_url_path='', **kwargs)
sys.path.insert(0, dir_path)

# Session key for the application session
app.config['SECRET_KEY'] = os.urandom(12).hex()

entity = importer(f"{dir_name}.views.entity")
app.register_blueprint(entity)

Expand Down
28 changes: 28 additions & 0 deletions setup_federation/openid_provider/certs/cert.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-----BEGIN CERTIFICATE-----
MIIE1jCCAr6gAwIBAgIJAKfFQiMtLzHBMA0GCSqGSIb3DQEBCwUAMBYxFDASBgNV
BAMMC2V4YW1wbGUuY29tMB4XDTIwMDIwMzE1MzIzOVoXDTMwMDEzMTE1MzIzOVow
FjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
ggIKAoICAQC5AlQs6EvAklf4ca/dJCpep1cGNTuZl+8AvZ7TgUbbANet3sG1n0gP
msqLtuXonrGpcWi5iXEvj5ukezTGyTp0gfSXswO5ZaZIwZIV+SVftatvk6gv+kEJ
xnnPHrte362XfKnJ2CHa2ONvWH0hsfYEZI0XAnUrMjis6MLakBvVObRn0/Bamnbn
oKUbm2XbykoNjejEY6GXzDZvusjZMbj3nj6zFfC3J8COLRlHA5plf5Ji02nG+Hbu
jQjMF3RABkf+iILI6AF0wvwuzaYIP2iZs0SrRASqLIv1cf/r3WVeMb/T6pSG8hOq
EZIQLLS4fpQLrXfjD9x8eLHvQycDQkpfYspuy1OGKc8Iz6D6P7Kw3rTZTU9AWCSp
I+xxiZMCXwBobthCdfhzEZKlf6vCqW/b08dDS2e5VeM77GaMRv+MWJ83bvv9Rn4+
lJJhVuRLeAeEwaaEA63g1mSJ33lvUmdkLLhLp5YCLvEA1aBzlnj58VXIeoWyo51D
nRPrtSHbLXhC8z1vJkC7G3+P92K+KQmtK0ESdjvuiPePUQwoadrr5EZxTYDPXzxV
An1wY6HB+XTy923h4QA0K38RsYQfpRSnwZim9gKpcj584eS4+V9+/G8K9jApgn2+
mjlaIz90qqHVm2MYQWiWtzAmk2NYXrY7uNyHBkpHw5F4Y3Gy1wWgeQIDAQABoycw
JTAjBgNVHREEHDAaggtleGFtcGxlLmNvbYILZXhhbXBsZS5uZXQwDQYJKoZIhvcN
AQELBQADggIBAICzblWmzH9ExIbjkGifLLT5BOdH7ZNceoMZyjKfN3Rfc5SrHiPV
VlWCFeVtfI5ClIaRqroKCRmsbAtIC30u52WrQkSFvsKOhOyOwiH3afbLqHcq8sZf
1HpJqe3kx15mlX/ZnovqCTEaW+oDvNis8uQ4DQ8hRZYwnAdr8U8w1bFzcDkai4e8
40aTwdTQnzj968KP0HRj1Jj29OR231KZpQruG+uAlSPSGa3V2jxD+FXezOd4clCD
3JbeVEoj62DbUyXqje9TcNapFLtEmhCW/grOwi8AQECec3aZSQOaPT33vay7ws00
UkNFRCsarMFSvcUSqEhJGKbjrh1p6guqLZxDwSOC2oqJpDMMpekfgQNTUO8BFqEg
7+//Nw8TugCcXw5vveUlcduwt8j8a5Jtj8uNRWce6cJ4ZaGTCpign8FYRi2lUEdA
dfJOyTajvstEy3zeFMnKAqWa10slHIsLSC5KzEkhgChuTNgXEPKn8ccF9s4bWq3c
l/MFDxr0X0IC8ihOtWQPdtOtjBA29UtpGhYWJ8C9m8MRzVcTszrKatVe9jjst/oi
YnZrJbEPhpMvIcmICSCfY2rtDTVd6urRewma+5bbgncroFp6gFCoxT69rOzsdj5U
RBwQifnbVWLxSK+UhhLJyZLChmCTdsGa8v8xCpGf97Gue5l99l7MfKSZ
-----END CERTIFICATE-----
28 changes: 28 additions & 0 deletions setup_federation/openid_provider/certs/example.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-----BEGIN CERTIFICATE-----
MIIEvjCCAqagAwIBAgIJAPzktJKkVjyWMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNV
BAMMCTEyNy4wLjAuMTAeFw0yMDAyMDMxODU1NTZaFw0zMDAxMzExODU1NTZaMBQx
EjAQBgNVBAMMCTEyNy4wLjAuMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
ggIBAMImFTNFtJuJKj93E4qakRFtJZ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q6Y9TEM0vAhc98cDMqWq6Jln/UVKqAkH40P9etI2y3IL28A4rp9Kxe
jOBzIsr/0Cl7bvZNpCZ3kdTAF8vBKV63UVngIU5vFKre6l3bPRayZbKc/rgUfN+v
GKNMVe7NQAoNWhq1Ilt8V+HccNtFSeJi41f0nzeuv/U3OwseG4si73awqv5vyrn8
RiqWRuV1JNj1kRYU+1QP+grLlIyNqs3s3lvXeYmlkxEvmupnPJU1O95jAG4pigjT
6Z8Qy4fyjMpfsOrdQMbKTtLOamY3zfQLuez/8zNhZcsARd3CVNa3TgqRNgKtfT45
RR6BaKSg57NJI1iFrnbzjLoR
-----END CERTIFICATE-----
52 changes: 52 additions & 0 deletions setup_federation/openid_provider/certs/example.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDCJhUzRbSbiSo/
dxOKmpERbSWb9X7rqhPOVjhdm79lDLbbmIsIHJul3SGvk5mHIQ02SQpvm/hbAfA0
a4ee2BpMEIaIp0TekSsRFe0JcolnkPnEnOhODZqjM7ydahol4Ik1zMmRQyjmO7ni
DcNVERmGgQnKLdUk6UFnAx/bEIRAXpmugg8hv+7MBocEfxo1zNSjHROtJ5OhbOfs
2H2zELVO0zfGzWNL8oSMewd5RD4etVrvubM3USST+p+fj8fxvkm02g3i2aNkBmNQ
X74a+MfJzdbUL97BiWaWoa0g4ceJKx0YIFS8llcJTBOwJvswkZJY5uNjeW3I8xTr
ZWPC4THk+U36CxtDzAsNFiE04zQuL1BBm5EjPMamavvgJb/SoQlag+f4zZEqp7Nu
G1BjgiMWisrh+sRW3FR9exr6szVLlXQA99+KiLrwAGjUD71umzDAG1RxJA2A19pt
F0oDAqrtUsbPb5IYEicC6HRJ0hhQWVJ0MOS4zhQfGweMeGriPxpEmAZazTn8mLKj
g0na5fnqyw2Nh4sesaldQtMcjpY2EsFdPVDZpoA4nsasqYcEb9GItT4V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BaPwi
kYJUUXXPXxZD6GY/Juu+/G/dmYIwp/Iy5Y1oIV8V75TYpIp38iIQrhwil1wmCQvI
OMECggEBAKb/hSBX7Z0sz0hbTPdUpQK/OWND8hKpkq+FqJxkQbzSesUk8DbCm8wz
ciOLa6ssWu8le4nIDpcySTZSahXAZF7thI1l5S5kVGLz51dPfLMZnQff7Endykdj
doGwS1BZows799AcccE5FxwH47/xMzGvM+hP/cn3uYU5f6DgMCGzQFz4pPx1SRN1
ujb0io34/XV3ZtSitMSwqvucTDNzrKF9DBT65/XgUlz6uvlyWpf5ntmIykWUCexr
NPPnAlAIPztWJ9uEEdTX/UVLP99IUESEgGZfmnUVXf9ixAB6buWmnFOtGutahPtC
Fwjw1JIGykNEpzQej6jgYXXnqoL8pas=
-----END PRIVATE KEY-----
Loading

0 comments on commit ff58301

Please sign in to comment.