Commit b9c16b5
Changed files (2)
bin
bin/ui
@@ -139,6 +139,27 @@ class UI
case request.request_method
when Rack::GET
case request.path
+ when "/index.html"
+ template = <<~ERB
+ <!DOCTYPE html>
+ <html>
+ <head><title></title></head>
+ <body style="background-color: pink;">
+ <a href="/saml/new">SAML Login</a>
+ <a href="/oidc/new">OIDC Login</a>
+ <%- if request.session[:access_token] -%>
+ <h1>Access Token</h1>
+ <pre><%= request.session[:access_token] %></pre>
+ <%- end -%>
+ <%- if request.session[:id_token] -%>
+ <h1>ID Token</h1>
+ <pre><%= request.session[:id_token] %></pre>
+ <%- end -%>
+ </body>
+ </html>
+ ERB
+ html = ERB.new(template, trim_mode: '-').result(binding)
+ return [200, { 'Content-Type' => "text/html" }, [html]]
when "/groups.html"
if current_user?(request)
return get_groups(request)
@@ -160,10 +181,13 @@ class UI
when "/saml/new"
return saml_post_to_idp(Rack::Request.new(env))
else
- return redirect_to("/saml/new")
+ return redirect_to("/index.html")
end
when Rack::POST
case request.path
+ when "/logout"
+ request.session.delete(:user_id)
+ return redirect_to("/")
when "/saml/assertions"
return saml_assertions(Rack::Request.new(env))
else
@@ -202,7 +226,7 @@ class UI
<!DOCTYPE html>
<html>
<head><title></title></head>
- <body>
+ <body style="background-color: pink;">
<pre style="display: none;"><%= response.body %></pre>
<pre><%= JSON.pretty_generate(request.session[:access_token]) %></pre>
<a href="/groups.html">Groups</a>
@@ -230,8 +254,11 @@ class UI
<head>
<title></title>
</head>
- <body>
+ <body style="background-color: pink;">
<a href="/groups.html">Groups</a>
+ <form action="/logout" method="post">
+ <input type="submit" value="Logout" />
+ </form>
<table>
<thead>
<tr>
@@ -279,7 +306,7 @@ class UI
<head>
<title></title>
</head>
- <body>
+ <body style="background-color: pink;">
<a href="/groups.html">Groups</a>
<table>
<thead>
policy.csv
@@ -10,3 +10,4 @@ p, *, ui.example.com, (GET)|(POST), /oauth*
p, *, ui.example.com, (GET)|(POST), /oidc*
p, *, ui.example.com, (GET)|(POST), /saml*
p, *, ui.example.com, (GET), /*.html
+p, *, ui.example.com, (POST), /logout