-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
71 changed files
with
21,351 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
displayName: "Azure JWT token validation" | ||
import: github.com/dkijkuit/azurejwttokenvalidation | ||
summary: "Validates JWT tokens generated by Azure and verifies the claims. Allows payload validation based on Azure roles as well." | ||
iconPath: icon/microsoft_azure_logo_icon.png | ||
testData: | ||
audience: audience_test | ||
issuer: "https://issuer.test" | ||
keysurl: "https://jwks.keys" | ||
matchallroles: true | ||
roles: | ||
- Test.Role.1 | ||
- Test.Role.2 | ||
type: middleware |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Dynamic configuration | ||
|
||
http: | ||
routers: | ||
my-router: | ||
rule: Path(`/whoami`) | ||
service: service-whoami | ||
entryPoints: | ||
- http | ||
middlewares: | ||
- azure-jwt-check | ||
|
||
services: | ||
service-whoami: | ||
loadBalancer: | ||
servers: | ||
- url: http://127.0.0.1:5000 | ||
|
||
middlewares: | ||
azure-jwt-check: | ||
plugin: | ||
dev: | ||
keysurl: "https://jwks.keys" | ||
issuer: "https://issuer.test" | ||
audience: | ||
- "audience" | ||
roles: | ||
- Test.Role.1 | ||
- Test.Role.2 | ||
matchallroles: true | ||
loglevel: "DEBUG" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module github.com/dkijkuit/azurejwttokenvalidation | ||
|
||
go 1.16 | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/dgrijalva/jwt-go v3.2.0+incompatible | ||
github.com/stretchr/testify v1.7.0 | ||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= | ||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= | ||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= | ||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package azurejwttokenvalidation | ||
|
||
import ( | ||
"encoding/json" | ||
) | ||
|
||
type AzureJwt struct { | ||
Header AzureJwtHeader | ||
Payload Claims | ||
Signature []byte | ||
RawToken []byte | ||
RawPayload []byte | ||
} | ||
|
||
type AzureJwtHeader struct { | ||
Alg string `json:"alg"` | ||
Kid string `json:"kid"` | ||
Typ string `json:"typ"` | ||
} | ||
|
||
type Claims struct { | ||
Iat json.Number `json:"iat"` | ||
Exp json.Number `json:"exp"` | ||
Iss string `json:"iss"` | ||
Aud string `json:"aud"` | ||
Sub string `json:"sub"` | ||
Roles []string `json:"roles"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Static configuration | ||
api: | ||
dashboard: true | ||
insecure: true | ||
|
||
pilot: | ||
token: <YOUR_TOKEN> | ||
|
||
log: | ||
level: DEBUG | ||
|
||
experimental: | ||
devPlugin: | ||
goPath: /home/david/go/ | ||
moduleName: github.com/dkijkuit/azurejwttokenvalidation | ||
|
||
entryPoints: | ||
http: | ||
address: ":4000" | ||
forwardedHeaders: | ||
insecure: true | ||
|
||
providers: | ||
file: | ||
filename: dynamic-dev-config.yml |
Oops, something went wrong.