You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32-16Lines changed: 32 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,17 +2,22 @@
2
2
3
3
## Aims
4
4
5
-
**Umbraco Authorized Services** is an Umbraco package designed to reduce the effort needed to integrate third party services that require authentication and authorization via an OAuth flow into Umbraco solutions. It's based on the premise that working with these services requires a fair bit of plumbing code to handle creating an authorized connection. This is necessary before the developer working with the service can get to actually using the provided API to implement the business requirements.
5
+
**Umbraco Authorized Services** is an Umbraco package designed to reduce the effort needed to integrate third party services that require authentication and authorization via an OAuth or API key based flow into Umbraco solutions. It's based on the premise that working with these services requires a fair bit of plumbing code to handle creating an authorized connection. This is necessary before the developer working with the service can get to actually using the provided API to implement the business requirements.
6
6
7
7
Having worked with a few OAuth integrations across different providers, as would be expected, there are quite a few similarities to the flow that needs to be implemented. Steps include:
8
8
9
9
- Redirecting to an authentication endpoint.
10
-
- Handling the response including an authentication code and exchanging it for an access token.
10
+
- Handling the response including an authentication code (or an oauth token and verifier code) and exchanging it for an access token.
11
11
- Securely storing the token.
12
12
- Including the token in API requests.
13
13
- Serializing requests and deserializing the API responses.
14
14
- Handling cases where the token has expired and obtaining a new one via a refresh token.
15
15
16
+
For API key based flows, the integration steps include:
17
+
18
+
- Use an API key stored in the settings file or persisted into the database to serialize requests and deserialize the API responses.
19
+
- Use provisioning options for passing the key to the API.
20
+
16
21
There are though also differences, across request and response structures and variations in the details of the flow itself.
17
22
18
23
The idea of the package is to try to implement a single, best practice implementation of working with OAuth that can be customized, via configuration or code, for particular providers.
@@ -23,7 +28,7 @@ For the solution developer, the Umbraco Authorized Services offers two primary f
23
28
24
29
Firstly there's an tree available in the _Settings_ section of the backoffice, called _Authorized Services_. The tree shows the list of services based on the details provided in configuration.
25
30
26
-
Each tree entry has a management screen where an administrator can authenticate with an app that has been setup with the service. The status of each service, in terms of whether the authentication and authorization flow has been completed and an access token stored, is shown on this screen.
31
+
Each tree entry has a management screen where an administrator can authenticate with an app that has been setup with the service. The status of each service, in terms of whether the authentication and authorization flow has been completed and an access token (or API key) stored, is shown on this screen.
@@ -204,7 +211,7 @@ An enum value that controls how the request to retrieve an access token is forma
204
211
205
212
###### RequestAuthorizationPath
206
213
207
-
Required in `OAuth1a` flows for building the service authorization URL.
214
+
Required in `OAuth1` flows for building the service authorization URL.
208
215
209
216
###### JsonSerializer
210
217
@@ -230,10 +237,12 @@ For `ApiKey` authentication methods, options for passing the API key need to be
230
237
###### ClientId *
231
238
232
239
This value will be retrieved from the registered service app.
240
+
For `OAuth1` flows it matches the `consumer key` value from the registered service app.
233
241
234
242
###### ClientSecret *
235
243
236
244
This value will be retrieved from the registered service app. As the name suggests, it should be kept secret and so is probably best not added directly to `appSettings.json` and checked into source control.
245
+
For `OAuth1` flows it matches the `consumer secret` value from the registered service app.
237
246
238
247
###### UseProofKeyForCodeExchange *
239
248
@@ -248,6 +257,9 @@ compare it with the previously sent `code_challenge`.
248
257
249
258
This value will be configured on the service app and retrieved from there. Best practice is to define only the set of permissions that the integration will need. For GitHub, the single scope needed to retrieve details about a repository's contributors is `repo`.
250
259
260
+
###### IncludeScopesInAuthorizationRequest
261
+
Specifies whether the provided scopes should be included in the authorization request body (e.g. `Microsoft`).
262
+
251
263
###### AccessTokenResponseKey
252
264
253
265
The expected key for retrieving an access token from a response. If not provided the default `access_token` is assumed.
@@ -387,6 +399,10 @@ Responsible for creating an HTTP client used for making authorization requests t
387
399
388
400
Responsible for creating a dictionary of parameters provided in the request to retrieve an access token from an authorization code. Implemented by `AuthorizationParametersBuilder`.
389
401
402
+
#### IAuthorizationPayloadBuilder
403
+
404
+
Responsible for generating the authorization payload used between the authorization and access token requests. Implemented by `AuthorizationPayloadBuilder`.
405
+
390
406
#### IAuthorizationRequestSender
391
407
392
408
Responsible for sending the request to retrieve access tokens. Implemented by `AuthorizationRequestSender`, which depends on `IAuthorizationClientFactory`.
@@ -403,6 +419,10 @@ Responsible for building the URL used to instigate the authentication and author
403
419
404
420
Responsible for creating a request to an authorized service, providing the content and access token. Implemented by `AuthorizedRequestBuilder`.
405
421
422
+
#### IExchangeTokenParametersBuilder
423
+
424
+
Responsible for defining the operations building the dictionary of parameters used in exchange token authorization requests. Implemented by `ExchangeTokenParametersBuilder`.
425
+
406
426
#### IAuthorizedServiceCaller
407
427
408
428
Responsible for making requests to the authorized services for the purposes of accessing business functionality. This is used by Umbraco solution developers and is described in detail above. Implemented by `AuthorizedServiceCaller`.
Responsible for generating the authorization payload used between the authorization and access token requests. Implemented by `AuthorizedServiceAuthorizationPayloadBuilder`.
460
+
Responsible for storing tokens. Implemented by `InMemoryTokenStorage`, `DatabaseOAuth1TokenStorage` and `DatabaseOAuth2TokenStorage`.
0 commit comments