Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/duksis/cloudflare_access
Elixir Plug for verifying Cloudflare Access headers
https://github.com/duksis/cloudflare_access
Last synced: 18 days ago
JSON representation
Elixir Plug for verifying Cloudflare Access headers
- Host: GitHub
- URL: https://github.com/duksis/cloudflare_access
- Owner: duksis
- License: mit
- Created: 2021-07-08T12:07:39.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-08T08:17:42.000Z (about 3 years ago)
- Last Synced: 2024-10-16T09:36:01.713Z (about 1 month ago)
- Language: Elixir
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CloudflareAccess
![Tests](https://github.com/duksis/cloudflare_access/actions/workflows/cf.yml/badge.svg)
Plug for verifying Cloudflare Access headers inside your Plug application.
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `cloudflare_access` to your list of dependencies in `mix.exs`:```elixir
def deps do
[
{:cloudflare_access, "~> 0.1.0"}
]
end
```## Usage
Adding header check to your router:
```
defmodule YourAppRouter do
use Plug.Routerplug(Plug.CloudflareAccess)
...
end
```
Configuring domain name for Cloudflare Access public key retrieval.
```
# in your config/config.exsconfig :cloudflare_access, domain: "exapmle.com"
```For loading Cloudflare public key for your domain on application boot
```
defmodel YourApplication do
use Application
...
def start(_type, _args) do
...
# Retrieve CF access certificate from CF and save in ETS
CloudflareAccess.cache()
...
end
...
end
```Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/cloudflare_access](https://hexdocs.pm/cloudflare_access).## License
`cloudflare_access` is released under the [MIT License](./LICENSE).