|
| 1 | +.. _move: |
| 2 | + |
| 3 | +******************************************************** |
| 4 | +How to move from oidcmsg,oidcrp and oidc-op to idpy-oidc |
| 5 | +******************************************************** |
| 6 | + |
| 7 | +Since you are here the chance that you are using OidcRP and/or oidc-op is very |
| 8 | +high. Hopefully you are happy with what the packages has provided you with |
| 9 | +so far. But somehow you have now learned that idpy-oidc is where the |
| 10 | +action will be in the future so you want to know what it takes to move |
| 11 | +from OidcRP and/or oidc-op to idpy-oidc. |
| 12 | + |
| 13 | +idpy-oidc is collecting the three original packages into one: |
| 14 | + |
| 15 | +* OidcMsg -> idpy-oidc/message |
| 16 | +* OidcRP -> idpy-oidc/client |
| 17 | +* oidc-op -> idpy-oidc/server |
| 18 | + |
| 19 | +Some of the functionality that was in OidcMsg because it was needed by |
| 20 | +both OidcRP and oidc-op is now placed at the root of idpy-oidc. |
| 21 | +We will do them one by one |
| 22 | + |
| 23 | +OidcRP |
| 24 | +------ |
| 25 | + |
| 26 | +If you have kept yourself to always using the high level api moving |
| 27 | + |
| 28 | +You probably can get away only doing what I descibe below. |
| 29 | +These are the steps I had to take to get the example/flask_rp RP working. |
| 30 | + |
| 31 | +1) Created a file, named script_py.sed with this content:: |
| 32 | + |
| 33 | + s/from oidcop.server import Server/from idpyoidc.server import Server/g |
| 34 | + s/oidcop/idpyoidc.server/g |
| 35 | + s/oidcrp/idpyoidc.client/g |
| 36 | + s/oidcmsg/idpyoidc.message/g |
| 37 | + s/idpyoidc.message.configure/idpyoidc.configure/g |
| 38 | + s/idpyoidc.message.client/idpyoidc.client/g |
| 39 | + s/idpyoidc.message.ssl_context/idpyoidc.ssl_context/g |
| 40 | + s/from idpyoidc.client.util import create_context/from idpyoidc.ssl_context import create_context/g |
| 41 | + |
| 42 | +2) Create another file, named script_json.sed with this content:: |
| 43 | + |
| 44 | + s/oidcop/idpyoidc.server/g |
| 45 | + s/oidcrp/idpyoidc.client/g |
| 46 | + s/oidcmsg/idpyoidc.message/g |
| 47 | + |
| 48 | +3) Ran the commands:: |
| 49 | + |
| 50 | + find . -name "*.py" -exec sed -i '' -f script_py.sed {} \; |
| 51 | + find . -name "*.json" -exec sed -i '' -f script_json.sed {} \; |
| 52 | + |
| 53 | +And I was able to successfully launch the RP. |
| 54 | +This worked for me, it might be enough for you too. If not you can probably |
| 55 | +figure out what needs changing. If you do I'd appreciate letting me know |
| 56 | +so I can add those steps to this document. |
| 57 | + |
| 58 | +oidc-op |
| 59 | +------- |
| 60 | + |
| 61 | +Getting oidc-op/example/flask_op running was a bit trickier but not a lot. |
| 62 | + |
| 63 | +Started of with creating the sed script files: |
| 64 | + |
| 65 | +1) Created a file, named script_py.sed with this content:: |
| 66 | + |
| 67 | + s/from oidcop.server import Server/from idpyoidc.server import Server/g |
| 68 | + s/oidcop/idpyoidc.server/g |
| 69 | + s/oidcrp/idpyoidc.client/g |
| 70 | + s/oidcmsg/idpyoidc.message/g |
| 71 | + s/idpyoidc.message.configure/idpyoidc.configure/g |
| 72 | + s/idpyoidc.message.client/idpyoidc.client/g |
| 73 | + s/idpyoidc.message.ssl_context/idpyoidc.ssl_context/g |
| 74 | + s/from idpyoidc.server.utils import create_context/from idpyoidc.ssl_context import create_context/g |
| 75 | + |
| 76 | +2) Create another file, named script_json.sed with this content:: |
| 77 | + |
| 78 | + s/oidcop/idpyoidc.server/g |
| 79 | + s/oidcrp/idpyoidc.client/g |
| 80 | + s/oidcmsg/idpyoidc.message/g |
| 81 | + |
| 82 | +3) Ran the commands:: |
| 83 | + |
| 84 | + find . -name "*.py" -exec sed -i '' -f script_py.sed {} \; |
| 85 | + find . -name "*.json" -exec sed -i '' -f script_json.sed {} \; |
| 86 | + |
| 87 | +Now, I had to edit 2 files. |
| 88 | + |
| 89 | +views.py |
| 90 | +++++++++ |
| 91 | + |
| 92 | +Removed the single line (22):: |
| 93 | + |
| 94 | + from oidcop.exception import TokenAuthenticationError |
| 95 | + |
| 96 | +and the lines (233-238:: |
| 97 | + |
| 98 | + except TokenAuthenticationError as err: |
| 99 | + _log.error(err) |
| 100 | + return make_response(json.dumps({ |
| 101 | + 'error': 'invalid_token', |
| 102 | + 'error_description': str(err) |
| 103 | + }), 401) |
| 104 | + |
| 105 | + |
| 106 | +config.json |
| 107 | ++++++++++++ |
| 108 | + |
| 109 | +Removed the line (312) :: |
| 110 | + |
| 111 | + "jwks_file": "private/token_jwks.json", |
| 112 | + |
| 113 | +And that was it. |
0 commit comments