nginx-lua-oauth2
A Nginx lua plugin for OAuth 2.0
$ opm get Valdanitooooo/nginx-lua-oauth2
nginx-lua-oauth2
nginx module for oauth2 authentication
install lua-cjson and nginx-extras
sudo apt install lua-cjson nginx-extras
install this library
sudo cp -r nginx-lua-oauth2.lua resty /usr/share/lua/5.1/
put this in your nginx config
location /auth/ {
resolver 8.8.8.8 8.8.4.4;
lua_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.crt;
access_by_lua_block {
require("nginx-lua-oauth2").auth({
client_id = "dd9323ac-1bf8-45d1-806b-09b45e4d989f",
client_secret = "APwi9H4yOXMJ+NGeie/n8kXVBzry2misJi1fxrFNcRk=",
token_url = "https://login.windows.net/8371d803-6f9a-46e1-a8ae-eec4a1998cbd/oauth2/token",
authorize_url = "https://login.windows.net/8371d803-6f9a-46e1-a8ae-eec4a1998cbd/oauth2/authorize",
token_params = { resource = 'https://graph.windows.net/' }, # optional!
authorize_params = { resource = 'https://graph.windows.net/' }, # optional!
ssl_verify = true # optional
})
}
}
enjoy.
the current access_token / refresh_token can be obtained by reading
the cookie "oauth2_access_token" or "oauth2_refresh_token"
Authors
valdanito
License
apache2
Dependencies
ledgetech/lua-resty-http >= 0.13, Valdanitooooo/lua-resty-jwt >= 0.2.3, openresty
Versions
-
A Nginx lua plugin for OAuth 2.0 2022-07-06 10:22:16
-
A Nginx lua plugin for OAuth 2.0 2022-07-06 00:55:48
-
A Nginx lua plugin for OAuth 2.0 2022-07-05 10:51:01
-
A Nginx lua plugin for OAuth 2.0 2022-07-05 10:47:57
-
A Nginx lua plugin for OAuth 2.0 2022-07-05 09:06:57
-
A Nginx lua plugin for OAuth 2.0 2022-07-05 08:52:20
-
A Nginx lua plugin for OAuth 2.0 2022-07-05 08:48:39
-
A Nginx lua plugin for OAuth 2.0 2022-07-05 08:42:12
-
A Nginx lua plugin for OAuth 2.0 2022-07-05 08:25:44
-
A Nginx lua plugin for OAuth 2.0 2022-07-05 08:07:22
-
A Nginx lua plugin for OAuth 2.0 2022-07-05 07:29:27
-
A Nginx lua plugin for OAuth 2.0 2022-07-05 06:40:15
-
A Nginx lua plugin for OAuth 2.0 2022-07-05 03:58:19