umbraco / Umbraco.AuthorizedServices

Umbraco Authorized Services is an open-source package designed to reduce the effort needed to integrate third party services that require authentication and authorization via an OAuth flow.
MIT License
14 stars 7 forks source link

Tokens encryption and State management #3

Closed acoumb closed 1 year ago

acoumb commented 1 year ago

Current PR contains the implemented features for encrypting/decrypting access tokens and refresh tokens using the IDataProtectionProvider and state handling for OAuth requests during the authorization flow.

The tokens are encrypted in the storage provider during the CRUD operations, and maybe we can also consider encrypting the settings TokenEncryptionKey key using AES.

For authorization requests, a random string is generated for the service and used in the authorization request sent to the provider. The value is cached temporarily using a Singleton dictionary and validated during the service response evaluation. Then it gets removed from the cache.

acoumb commented 1 year ago

Included with this PR some additional changes to Authorized Services:

Testing with Aprimo succeeded with some "hacking", because the OAuth app is managed by them and I cannot change the redirect uri myself. Had to manually copy URL parts and jump between sessions to get some results. After Easter and release of the Aprimo package, I will address this with them and have the URL changed.

acoumb commented 1 year ago

Feedback resolved, merging updates.