Skip to content

Commit

Permalink
Polish examples
Browse files Browse the repository at this point in the history
  • Loading branch information
vasayxtx committed Feb 13, 2025
1 parent 3698c89 commit 5d8a6ac
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 deletions.
6 changes: 5 additions & 1 deletion examples/authn-middleware/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# AuthN Middleware Example

The example below demonstrates how to create a simple HTTP server that authenticates requests with JWT tokens.
The current example demonstrates how to create a simple HTTP server that authenticates requests with JWT tokens.

The complete code example is available in the [main.go](./main.go) file.

Configuration is stored in the [config.yml](./config.yml) file.

## Usage

Expand Down
4 changes: 1 addition & 3 deletions examples/authn-middleware/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ auth:
- http://127.0.0.1:8081
claimsCache:
enabled: true
maxEntries: 1000
introspection:
enabled: true
maxEntries: 1000
8 changes: 4 additions & 4 deletions examples/authn-middleware/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ func runApp() error {
}

type AppConfig struct {
Auth *authkit.Config `config:"auth"`
Log *log.Config `config:"log"`
Auth *authkit.Config
Log *log.Config
}

func NewAppConfig() *AppConfig {
return &AppConfig{
Log: log.NewConfig(),
Auth: authkit.NewConfig(),
Log: log.NewConfig(log.WithKeyPrefix("log")),
Auth: authkit.NewConfig(authkit.WithKeyPrefix("auth")),
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/idp-test-server/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# IDP Test Server Example

This is a simple test server that can be used to test the IDP client.
This is a [simple test server](./main.go) that can be used to test the IDP client.
It demonstrates how the `idptest` package can be used to create a simple IDP server.

## Usage
Expand Down
8 changes: 6 additions & 2 deletions examples/token-introspection/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Token Introspection Example

The example below demonstrates how to create a simple HTTP server that authenticates requests with JWT tokens using the token introspection endpoint.
The current example demonstrates how to create a simple HTTP server that authenticates requests with JWT tokens using the token introspection endpoint.
Additionally, it performs authorization based on the introspected token's scope.

The complete code example is available in the [main.go](./main.go) file.

Configuration is stored in the [config.yml](./config.yml) file.

## Usage

To be able to run this example, you need to have the IDP test server running (see [IDP Test Server Example](../idp-test-server/README.md) for more details).
Expand Down Expand Up @@ -108,7 +112,7 @@ auth:
clientKey: <path_to_client_key>
```

If you want to test introspection via gRPC, you can use the [gRPC introspection server example](./grpc-server).
If you want to test introspection via gRPC, you can use the [gRPC introspection server example](./grpc-server/main.go).
To start the gRPC introspection server, just run `go run ./grpc-server/main.go`.

Then modify the `config.yaml` file to use the gRPC introspection endpoint:
Expand Down
8 changes: 4 additions & 4 deletions examples/token-introspection/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ func runApp() error {
}

type AppConfig struct {
Auth *authkit.Config `config:"auth"`
Log *log.Config `config:"log"`
Auth *authkit.Config
Log *log.Config
}

func NewAppConfig() *AppConfig {
return &AppConfig{
Log: log.NewConfig(),
Auth: authkit.NewConfig(),
Log: log.NewConfig(log.WithKeyPrefix("log")),
Auth: authkit.NewConfig(authkit.WithKeyPrefix("auth")),
}
}

Expand Down

0 comments on commit 5d8a6ac

Please sign in to comment.