FdsnPlugs.JWTAuthentication (fdsn_plugs v0.9.2)
View SourcePlug to authenticate requests via JWT bearer tokens from multiple authorities.
The plug passes through when:
conn.assigns.useris already set (e.g. HTTP Digest auth already handled it)- no
Authorizationheader is present
Otherwise it tries each configured authority in order. On success it stores all
token claims in conn.assigns.jwt_claims and the email claim in
conn.assigns.user.
Usage
Add one FdsnPlugs.JwkStrategy per authority to your supervision tree:
children = [
{FdsnPlugs.JwkStrategy,
name: :authority1,
jwks_url: "https://auth.example.com/jwks",
first_fetch_sync: true}
]Then plug into your pipeline:
plug FdsnPlugs.JWTAuthentication, authorities: [:authority1]