-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoauth-nginx-example.conf
39 lines (33 loc) · 1.34 KB
/
oauth-nginx-example.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
resolver 8.8.8.8;
# This should only be enabled for development
lua_code_cache off;
init_by_lua_block {
oauth_authorize_url = 'https://github.com/login/oauth/authorize'
oauth_client_secret = '<Your client secret>'
oauth_client_id = '<Your client id>'
oauth_org = '<The organization whose members are to be allowed>'
oauth_blocklist = ''
}
server {
listen 80;
# Or alternatively, and with lesser precedence:
#
# set $oauth_client_id '<Your client id>';
# set $oauth_client_secret '<Your client secret>';
# set $oauth_authorize_url 'https://github.com/login/oauth/authorize';
# set $oauth_org '<The organization whose members are to be allowed>';
# set $oauth_blocklist '';
location ~ /_oauth/api/(?<api_uri>.*) { proxy_pass https://api.github.com/$api_uri; }
location /_oauth/access_token { proxy_pass https://github.com/login/oauth/access_token; }
location /_oauth/callback { content_by_lua_file '/vagrant/oauth-callback.lua'; }
location /_oauth/logout { content_by_lua_file '/vagrant/oauth-logout.lua'; }
location /_oauth/login { content_by_lua_file '/vagrant/oauth-login.lua'; }
location / {
access_by_lua_file "/vagrant/oauth-access.lua";
content_by_lua_block {
ngx.header['Content-type'] = 'text/html'
ngx.say('You have been authenticated')
ngx.exit(ngx.HTTP_OK)
}
}
}