-
Notifications
You must be signed in to change notification settings - Fork 221
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
19 changed files
with
247 additions
and
102 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
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
File renamed without changes.
File renamed without changes.
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,51 @@ | ||
# Static Token Authentication Example | ||
|
||
This example shows how you can secure your Flipt instance with a static bootstrap token: <https://www.flipt.io/docs/configuration/authentication#method-static-token> | ||
|
||
**Note:** You will not be able to use the Flipt UI with this example as it does not support static token authentication. | ||
See the [Dex example](../dex/README.md) to see how to configure Flipt to use OIDC for authentication and enable the UI. | ||
|
||
## Requirements | ||
|
||
To run this example application you'll need: | ||
|
||
* [Docker](https://docs.docker.com/install/) | ||
* [docker-compose](https://docs.docker.com/compose/install/) | ||
|
||
## Running the Example | ||
|
||
1. Run `docker-compose up` from this directory | ||
1. Try to get a list of flags without authenticating using the REST API: | ||
|
||
```shell | ||
❯ curl -v http://localhost:8080/api/v1/flags | ||
|
||
> GET /api/v1/flags HTTP/1.1 | ||
> Host: localhost:8080 | ||
> Accept: */* | ||
> | ||
< HTTP/1.1 401 Unauthorized | ||
< Content-Type: text/plain; charset=utf-8 | ||
``` | ||
|
||
1. You should get a **401 Unauthorized** response as no authentication was present on the request | ||
1. Try again, providing the bootstrap token `secret`, specified in the [docker-compose.yml](docker-compose.yml) file: | ||
|
||
```shell | ||
~ » curl -v -H 'Authorization: Bearer secret' http://localhost:8080/api/v1/flags | ||
> GET /api/v1/flags HTTP/1.1 | ||
> Host: localhost:8080 | ||
> Accept: */* | ||
> Authorization: Bearer secret | ||
> | ||
< HTTP/1.1 200 OK | ||
< Content-Type: application/json | ||
< Grpc-Metadata-Content-Type: application/grpc | ||
< X-Content-Type-Options: nosniff | ||
< Content-Length: 46 | ||
< | ||
{"flags":[],"nextPageToken":"","totalCount":0} | ||
``` | ||
|
||
1. This time the request succeeds and a **200 OK** response is returned |
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,17 @@ | ||
log: | ||
level: DEBUG | ||
|
||
db: | ||
url: file:/var/opt/flipt/flipt.db | ||
|
||
authentication: | ||
required: true | ||
methods: | ||
token: | ||
enabled: true | ||
bootstrap: | ||
token: "secret" | ||
expiration: 24h | ||
cleanup: | ||
interval: 2h | ||
grace_period: 48h |
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,18 @@ | ||
version: "3" | ||
|
||
services: | ||
flipt: | ||
image: flipt/flipt:latest | ||
command: ["./flipt", "--force-migrate"] | ||
ports: | ||
- "8080:8080" | ||
volumes: | ||
- ./config.yml:/etc/flipt/config/default.yml | ||
environment: | ||
- FLIPT_LOG_LEVEL=debug | ||
- FLIPT_META_TELEMETRY_ENABLED=false | ||
networks: | ||
- flipt_network | ||
|
||
networks: | ||
flipt_network: |
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.