Skip to content

Commit e7ad1b1

Browse files
committed
Show received NameID when logged. Show received attributes
1 parent 2a3bff3 commit e7ad1b1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

app/controllers/saml_controller.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class SamlController < ApplicationController
22
skip_before_action :verify_authenticity_token, :only => [:acs, :logout]
33

44
def index
5-
@attrs = []
5+
@attrs = {}
66
end
77

88
def sso
@@ -21,13 +21,13 @@ def acs
2121
response = OneLogin::RubySaml::Response.new(params[:SAMLResponse])
2222
response.settings = Account.get_saml_settings
2323

24-
logger.info "NAMEID: #{response.name_id}"
25-
2624
if response.is_valid?
2725
session[:user_id] = response.name_id
2826
session[:attributes] = response.attributes
2927
@attrs = session[:attributes]
30-
redirect_to root_path
28+
logger.info "Sucessfully logged"
29+
logger.info "NAMEID: #{response.name_id}"
30+
render :action => :index
3131
else
3232
render :action => :fail
3333
end

app/views/saml/index.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<% if session[:user_id].present? %>
2-
<p>Logged in.</p>
2+
<p>Logged in. <%= session[:user_id] %></p>
33

44
<% if @attrs.any? %>
5-
<p>You have the following attributes:</p>
5+
<p>Received the following attributes in the SAML Response:</p>
66
<table><thead><th>Name</th><th>Values</th></thead><tbody>
77

88
<% @attrs.each do |key,attr_value| %>

0 commit comments

Comments
 (0)