-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #417 from MadAppGang/feature/audit
Correct refresh token + audit
- Loading branch information
Showing
19 changed files
with
213 additions
and
93 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
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
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
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
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 |
---|---|---|
@@ -1,6 +1,4 @@ | ||
# this is compose for test environment | ||
|
||
version: "3" | ||
services: | ||
minio: | ||
image: quay.io/minio/minio:latest | ||
|
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
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
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 @@ | ||
package api | ||
|
||
import "log" | ||
|
||
func journal(userID, appID, action string, scopes []string) { | ||
// TODO: Create an interface for the audit log | ||
// Implement it for logging to stdout, a database, or a remote service | ||
log.Printf("audit record | %s | userID=%s appID=%s scopes=%v\n", | ||
action, userID, appID, scopes) | ||
} |
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
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
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
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 |
---|---|---|
|
@@ -11,7 +11,6 @@ import ( | |
|
||
jwt "github.com/golang-jwt/jwt/v4" | ||
ijwt "github.com/madappgang/identifo/v2/jwt" | ||
"github.com/madappgang/identifo/v2/model" | ||
"github.com/madappgang/identifo/v2/web/api" | ||
) | ||
|
||
|
@@ -65,15 +64,25 @@ func testOIDCServer() (*httptest.Server, context.CancelFunc) { | |
}) | ||
|
||
mux.HandleFunc("/token", func(w http.ResponseWriter, r *http.Request) { | ||
idt, err := model.NewTokenWithClaims(jwt.SigningMethodES256, "kid", jwt.MapClaims{ | ||
"sub": "abc", | ||
"emails": []string{"[email protected]"}, | ||
"email": "[email protected]", | ||
"iss": cfg.Issuer, | ||
"aud": "test", | ||
"exp": time.Now().Add(time.Hour).Unix(), | ||
"iat": time.Now().Unix(), | ||
}).SignedString(privateKey) | ||
token := jwt.Token{ | ||
Header: map[string]interface{}{ | ||
"typ": "JWT", | ||
"alg": jwt.SigningMethodES256.Alg(), | ||
"kid": "kid", | ||
}, | ||
Claims: jwt.MapClaims{ | ||
"sub": "abc", | ||
"emails": []string{"[email protected]"}, | ||
"email": "[email protected]", | ||
"iss": cfg.Issuer, | ||
"aud": "test", | ||
"exp": time.Now().Add(time.Hour).Unix(), | ||
"iat": time.Now().Unix(), | ||
}, | ||
Method: jwt.SigningMethodES256, | ||
} | ||
|
||
idt, err := token.SignedString(privateKey) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
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
Oops, something went wrong.