Skip to content

Commit df9a0eb

Browse files
author
Natalia
authored
Merge pull request #5 from wallester/chore/url-path
WA-522 Remove /api from endpoints paths, format code
2 parents cc44e00 + dc90fce commit df9a0eb

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Please take a look at example.js
128128
### Request
129129

130130
```
131-
POST /api/v1/test/ping HTTP/1.1
131+
POST /v1/test/ping HTTP/1.1
132132
Content-Type: application/json
133133
Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJFMkMwQUI1NS1EQzM5LTQxM0ItOTRDRi00QzZGQjJDRUU2RjAiLCJzdWIiOiJhcGktcmVxdWVzdCIsImlzcyI6IjdhNGYyMTIzLTM3ZmYtNDRiMy05MDI4LTM3NDdmNGU5M2IxYyIsInJiaCI6IkN1cFgwOVh3L1dVaUM4WVdzeUpsOVJVZ0F0Ylk5Tm1WYzA1QndRR1hremM9IiwiZXhwIjoxNTA4NTA3MjUxLCJpYXQiOjE1MDg1MDcxOTF9.Zn4y5Y09BZT4KrScGYw3K2zKLjEYgfxK20ZdvRYGFgaGj9V5ZZbnY1_nJ_u5xBh4ncoyaO6eaA0YqOjZ-hPsatw4IXVPLrILg8KU3XnyEY0rYrngNmoAq7idmJQMMmIGfbpR9EEULuEiLyjcENZxF3RyVmL_Ajy8qfoTFtewAbEOLLR1wnbuNFm534DbVnlvXI9_49sEx15Q9fUzn_AjEdjfYFCBBjM8krysswckxzRtZNJP70miCYProRv6EOTQCOPIBk-qDnkzaNPEZ1PIkCyIn-yakrG-26H55m0MdjOhr9DKvUGWk_Ew7OCsMdT2ZO1NdujWE7XBt3g5GF1Kkw
134134
User-Agent: Java/1.8.0_121

examples/csharp/App/Program.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Program
2020
private static string _audience = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
2121

2222
// Replace this with actual Wallester API URL
23-
private static string _apiURL = "http://xxx.wallester.eu/api/v1/test/ping";
23+
private static string _apiURL = "http://xxx.wallester.eu/v1/test/ping";
2424

2525
private static string _subject = "api-request";
2626

@@ -103,7 +103,7 @@ private static string DoRequest(string requestBody, SigningCredentials signingCr
103103
Console.WriteLine("Response is not trusted: " + e);
104104
}
105105
}
106-
106+
107107
return responseString;
108108
}
109109

@@ -121,17 +121,19 @@ private static void VerifyToken(String token, String responseBodyHash, SecurityK
121121
IssuerSigningKey = wallesterPublicKey,
122122
ValidateIssuerSigningKey = true
123123
};
124-
124+
125125
SecurityToken validatedToken;
126126
var handler = new JwtSecurityTokenHandler();
127127
var claimsPrincipal = handler.ValidateToken(token, tokenValidationParameters, out validatedToken);
128128

129129
var rbh = claimsPrincipal.FindFirst("rbh");
130-
if (rbh == null) {
130+
if (rbh == null)
131+
{
131132
throw new ApplicationException("missing response body hash");
132133
}
133134

134-
if (rbh.Value != responseBodyHash) {
135+
if (rbh.Value != responseBodyHash)
136+
{
135137
throw new ApplicationException("invalid response body hash: " + rbh.Value);
136138
}
137139

@@ -158,7 +160,7 @@ private static string CreateToken(string requestBodyHash, SigningCredentials sig
158160

159161
var notBefore = DateTime.UtcNow;
160162
var expires = DateTime.UtcNow.AddMinutes(1);
161-
var token = new JwtSecurityToken(_issuer, _audience, claims, notBefore, expires, signingCredentials);
163+
var token = new JwtSecurityToken(_issuer, _audience, claims, notBefore, expires, signingCredentials);
162164

163165
var handler = new JwtSecurityTokenHandler();
164166
return handler.WriteToken(token);

examples/java/src/main/java/App.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class App {
3333
private static final String audience = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
3434

3535
// Replace this with actual Wallester API URL
36-
private static final String apiURL = "http://xxx.wallester.eu/api/v1/test/ping";
36+
private static final String apiURL = "http://xxx.wallester.eu/v1/test/ping";
3737

3838
public static void main(String[] args) {
3939
try {
@@ -96,7 +96,7 @@ private static String doRequest(byte[] requestBody, PrivateKey privateKey, Publi
9696

9797
URL url = new URL(apiURL);
9898

99-
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
99+
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
100100
connection.setRequestMethod("POST");
101101
connection.setDoInput(true);
102102
connection.setDoOutput(true);

examples/nodejs/example.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const issuer = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
1010
const audience = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
1111

1212
// Replace this with actual Wallester API URL
13-
const apiURL = "http://xxx.wallester.eu/api/v1/test/ping";
13+
const apiURL = "http://xxx.wallester.eu/v1/test/ping";
1414

1515
const algorithm = "RS256";
1616

0 commit comments

Comments
 (0)