Skip to content

Commit 08302f4

Browse files
committed
Added missing badge plus some clean-up
1 parent 5739d14 commit 08302f4

File tree

1 file changed

+48
-65
lines changed

1 file changed

+48
-65
lines changed

README.md

Lines changed: 48 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
[![](https://sonarcloud.io/api/project_badges/measure?project=Mastercard_oauth1-signer-csharp&metric=alert_status)](https://sonarcloud.io/dashboard?id=Mastercard_oauth1-signer-csharp)
55
[![](https://github.com/Mastercard/oauth1-signer-csharp/workflows/broken%20links%3F/badge.svg)](https://github.com/Mastercard/oauth1-signer-csharp/actions?query=workflow%3A%22broken+links%3F%22)
66
[![](https://img.shields.io/nuget/v/Mastercard.Developer.OAuth1Signer.Core.svg?label=nuget%20|%20core)](https://www.nuget.org/packages/Mastercard.Developer.OAuth1Signer.Core/)
7-
[![](https://img.shields.io/nuget/v/Mastercard.Developer.OAuth1Signer.RestSharp.svg?label=nuget%20|%20restsharp)](https://www.nuget.org/packages/Mastercard.Developer.OAuth1Signer.RestSharp/)
7+
[![](https://img.shields.io/nuget/v/Mastercard.Developer.OAuth1Signer.RestSharp.svg?label=nuget%20|%20restsharp%20portable)](https://www.nuget.org/packages/Mastercard.Developer.OAuth1Signer.RestSharp/)
8+
[![](https://img.shields.io/nuget/v/Mastercard.Developer.OAuth1Signer.RestSharpV2.svg?label=nuget%20|%20restsharp)](https://www.nuget.org/packages/Mastercard.Developer.OAuth1Signer.RestSharpV2/)
89
[![](https://img.shields.io/badge/license-MIT-yellow.svg)](https://github.com/Mastercard/oauth1-signer-csharp/blob/master/LICENSE)
910

1011
## Table of Contents
@@ -20,13 +21,15 @@
2021
* [Integrating with OpenAPI Generator API Client Libraries](#integrating-with-openapi-generator-api-client-libraries)
2122

2223
## Overview <a name="overview"></a>
23-
Zero dependency library for generating a Mastercard API compliant OAuth signature.
24+
* `OAuth1Signer.Core` is a zero dependency library for generating a Mastercard API compliant OAuth signature
25+
* `OAuth1Signer.RestSharpV2` is an extension dedicated to [RestSharp](https://restsharp.dev/)
26+
* `OAuth1Signer.RestSharp` is an extension dedicated to [RestSharp Portable](https://github.com/FubarDevelopment/restsharp.portable) (project no longer maintained)
2427

2528
### Compatibility <a name="compatibility"></a>
2629

2730
#### .NET <a name="net"></a>
28-
* Both the Core and RestSharp (deprecated) libraries require a .NET Framework implementing [.NET Standard](https://docs.microsoft.com/en-us/dotnet/standard/net-standard) 1.3.
29-
* The RestSharp V2 library requires a .NET Framework implementing [.NET Standard](https://docs.microsoft.com/en-us/dotnet/standard/net-standard) 2.0.
31+
* `OAuth1Signer.Core` and `OAuth1Signer.RestSharp` require a .NET Framework implementing [.NET Standard](https://docs.microsoft.com/en-us/dotnet/standard/net-standard) 1.3.
32+
* `OAuth1Signer.RestSharpV2` requires a .NET Framework implementing [.NET Standard](https://docs.microsoft.com/en-us/dotnet/standard/net-standard) 2.0.
3033

3134
#### Strong Naming <a name="strong-naming"></a>
3235
Assemblies are strong-named as per [Strong naming and .NET libraries](https://docs.microsoft.com/en-us/dotnet/standard/library-guidance/strong-naming).
@@ -46,31 +49,14 @@ As part of this set up, you'll receive credentials for your app:
4649
* A private request signing key (matching the public certificate displayed on the Mastercard Developer Portal)
4750

4851
### Adding the Libraries to Your Project <a name="adding-the-libraries-to-your-project"></a>
49-
5052
#### Package Manager
51-
###### RestSharp
52-
```shell
53-
Install-Package Mastercard.Developer.OAuth1Signer.Core
54-
Install-Package Mastercard.Developer.OAuth1Signer.RestSharpV2
55-
```
56-
57-
###### RestSharp Portable (Deprecated)
5853
```shell
59-
Install-Package Mastercard.Developer.OAuth1Signer.Core
60-
Install-Package Mastercard.Developer.OAuth1Signer.RestSharp
54+
Install-Package Mastercard.Developer.OAuth1Signer.{Core|RestSharp|RestSharpV2}
6155
```
6256

6357
#### .NET CLI
64-
###### RestSharp
6558
```shell
66-
dotnet add package Mastercard.Developer.OAuth1Signer.Core
67-
dotnet add package Mastercard.Developer.OAuth1Signer.RestSharpV2
68-
```
69-
70-
###### RestSharp Portable (Deprecated)
71-
```shell
72-
dotnet add package Mastercard.Developer.OAuth1Signer.Core
73-
dotnet add package Mastercard.Developer.OAuth1Signer.RestSharp
59+
dotnet add package Mastercard.Developer.OAuth1Signer.{Core|RestSharp|RestSharpV2}
7460
```
7561

7662
### Loading the Signing Key <a name="loading-the-signing-key"></a>
@@ -84,7 +70,7 @@ var signingKey = AuthenticationUtils.LoadSigningKey(
8470
```
8571

8672
### Creating the OAuth Authorization Header <a name="creating-the-oauth-authorization-header"></a>
87-
The method that does all the heavy lifting is `OAuth.GetAuthorizationHeader`, in the `Mastercard.Developer.OAuth1Signer.Core` package.
73+
The method that does all the heavy lifting is `OAuth.GetAuthorizationHeader`, in the `OAuth1Signer.Core` package.
8874
You can call into it directly and as long as you provide the correct parameters, it will return a string that you can add into your request's `Authorization` header.
8975

9076
```cs
@@ -109,7 +95,7 @@ Usage briefly described below, but you can also refer to the test project for ex
10995

11096
#### System.Net.Http.HttpClient <a name="system-net-http-httpclient"></a>
11197

112-
The `NetHttpClientSigner` class is located in the `Mastercard.Developer.OAuth1Signer.Core` package.
98+
The `NetHttpClientSigner` class is located in the `OAuth1Signer.Core` package.
11399

114100
Usage:
115101
```cs
@@ -137,12 +123,7 @@ internal class RequestSignerHandler : HttpClientHandler
137123

138124
#### RestSharp <a name="restsharp"></a>
139125

140-
141-
The `RestSharpSigner` class can be used with both the RestSharp, and RestSharp Portable packages.
142-
It can be found in the following locations:
143-
144-
* RestSharpV2 (RestSharp) location: `Mastercard.Developer.OAuth1Signer.RestSharpV2`
145-
* RestSharp (RestSharp Portable) location: `Mastercard.Developer.OAuth1Signer.RestSharp`
126+
A `RestSharpSigner` class is provided for both RestSharp and RestSharp Portable. It can be found in the `OAuth1Signer.RestSharp` and `OAuth1Signer.RestSharpV2` packages.
146127

147128
Usage:
148129
```cs
@@ -168,57 +149,30 @@ It provides generators and library templates for supporting multiple languages a
168149
This project provides you with some authenticator classes you can use when configuring your API client. These classes will take care of adding the correct `Authorization` header before sending the request.
169150

170151
Generators currently supported:
171-
+ [csharp (targetFramework v5.0)](#csharp-generator-target-framework-v5)
172-
+ [csharp-netcore (targetFramework netcore2.0)](#csharp-netcore-generator-target-framework-netcore2.0)
173-
174-
#### csharp (targetFramework v5.0) <a name="csharp-generator-target-framework-v5"></a>
175-
176-
##### OpenAPI Generator
177-
178-
Client libraries can be generated using the following command:
179-
```shell
180-
java -jar openapi-generator-cli.jar generate -i openapi-spec.yaml -g csharp -c config.json -o out
181-
```
182-
config.json:
183-
```json
184-
{ "targetFramework": "v5.0" }
185-
```
152+
+ [csharp-netcore](#csharp-netcore-generator)
153+
+ [csharp (deprecated)](#csharp-generator)
186154

187-
See also:
188-
* [OpenAPI Generator (executable)](https://mvnrepository.com/artifact/org.openapitools/openapi-generator-cli)
189-
* [CONFIG OPTIONS for csharp](https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/csharp.md)
190155

191-
##### Usage of the `RestSharpOAuth1Authenticator`
192-
193-
`RestSharpOAuth1Authenticator` is located in the `Mastercard.Developer.OAuth1Signer.RestSharp` package.
194-
195-
```cs
196-
var config = Configuration.Default;
197-
config.BasePath = "https://sandbox.api.mastercard.com";
198-
config.ApiClient.RestClient.Authenticator = new RestSharpOAuth1Authenticator(ConsumerKey, signingKey, new Uri(config.BasePath));
199-
var serviceApi = new ServiceApi(config);
200-
// ...
201-
```
202-
203-
#### csharp-netcore (targetFramework netcore2.0) <a name="csharp-netcore-generator-target-framework-netcore2.0"></a>
156+
#### csharp-netcore<a name="csharp-netcore-generator-target-framework-netcore2.0"></a>
204157

205158
##### OpenAPI Generator
206159

207160
Client libraries can be generated using the following command:
208161
```shell
209-
java -jar openapi-generator-cli.jar generate -i openapi-spec.yaml -g csharp-netcore -c config.json -o out
162+
openapi-generator-cli generate -i openapi-spec.yaml -g csharp-netcore -c config.json -o out
210163
```
211164
config.json:
212165
```json
213166
{ "targetFramework": "netstandard2.0" }
214167
```
215168

216-
See also:
169+
See also:
170+
* [OpenAPI Generator (executable)](https://mvnrepository.com/artifact/org.openapitools/openapi-generator-cli)
217171
* [CONFIG OPTIONS for csharp-netcore](https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/csharp-netcore.md)
218172
219173
##### Usage of the `RestSharpSigner`
220174

221-
`RestSharpSigner` is located in the `Mastercard.Developer.OAuth1Signer.RestSharpV2` package.
175+
`RestSharpSigner` is located in the `OAuth1Signer.RestSharpV2` package.
222176

223177
##### Usage
224178

@@ -242,4 +196,33 @@ partial class ApiClient
242196
}
243197
```
244198

199+
#### csharp (deprecated)<a name="csharp-generator"></a>
200+
201+
##### OpenAPI Generator
202+
203+
Client libraries can be generated using the following command:
204+
```shell
205+
openapi-generator-cli generate -i openapi-spec.yaml -g csharp -c config.json -o out
206+
```
207+
config.json:
208+
```json
209+
{ "targetFramework": "netstandard1.3" }
210+
```
211+
212+
⚠️ `v5.0` was used for `targetFramework` in OpenAPI Generator versions prior 5.0.0.
245213

214+
See also:
215+
* [OpenAPI Generator (executable)](https://mvnrepository.com/artifact/org.openapitools/openapi-generator-cli)
216+
* [CONFIG OPTIONS for csharp](https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/csharp.md)
217+
218+
##### Usage of the `RestSharpOAuth1Authenticator`
219+
220+
`RestSharpOAuth1Authenticator` is located in the `OAuth1Signer.RestSharp` package.
221+
222+
```cs
223+
var config = Configuration.Default;
224+
config.BasePath = "https://sandbox.api.mastercard.com";
225+
config.ApiClient.RestClient.Authenticator = new RestSharpOAuth1Authenticator(ConsumerKey, signingKey, new Uri(config.BasePath));
226+
var serviceApi = new ServiceApi(config);
227+
// ...
228+
```

0 commit comments

Comments
 (0)