summaryrefslogtreecommitdiff
path: root/bin/ui
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-03-12 11:52:07 -0600
committermo khan <mo@mokhan.ca>2025-03-12 11:52:07 -0600
commit44a0ee1bf7cf1aff6c5bfc3ea6a437c49b5fb4e0 (patch)
treec9d19019f648765e36e13004beb7eef298897041 /bin/ui
parenta06598e7bec98aa1f9912f6ce1ff6d59c7e9ea04 (diff)
feat: render a simple login page
Diffstat (limited to 'bin/ui')
-rwxr-xr-xbin/ui4
1 files changed, 4 insertions, 0 deletions
diff --git a/bin/ui b/bin/ui
index a2a5db0..c459c4b 100755
--- a/bin/ui
+++ b/bin/ui
@@ -9,6 +9,7 @@ gemfile do
gem "erb", "~> 4.0"
gem "net-hippie", "~> 1.0"
gem "rack", "~> 3.0"
+ gem "rack-session", "~> 2.0"
gem "rackup", "~> 2.0"
gem "saml-kit", "~> 1.0"
gem "webrick", "~> 1.0"
@@ -137,6 +138,7 @@ class UI
saml_response = saml_binding.deserialize(request.params)
raise saml_response.errors unless saml_response.valid?
+ request.session[:access_token] = saml_response.attributes[:access_token]
template = <<~ERB
<!doctype html>
<html>
@@ -157,6 +159,8 @@ if __FILE__ == $0
app = Rack::Builder.new do
use Rack::CommonLogger
use Rack::Reloader
+ use Rack::Session::Cookie, { domain: $host.split(":", 2)[0], path: "/", secret: SecureRandom.hex(64) }
+
run UI.new
end.to_app