Commit 218c80c
Changed files (2)
app
controllers
config
app/controllers/metadata_controller.rb
@@ -0,0 +1,21 @@
+class MetadataController < ApplicationController
+ def show
+ render xml: to_xml
+ end
+
+ private
+
+ def to_xml
+ builder = Saml::Kit::IdentityProviderMetadata::Builder.new
+ builder.contact_email = 'hi@example.com'
+ builder.entity_id = metadata_url
+ builder.organization_name = "Acme, Inc"
+ builder.organization_url = root_url
+ builder.single_sign_on_location = new_session_url
+ builder.single_logout_location = session_url
+ builder.attributes << "id"
+ builder.attributes << "email"
+ builder.attributes << "created_at"
+ builder.build.to_xml
+ end
+end
config/routes.rb
@@ -1,4 +1,6 @@
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
- resource :session, only: [:new, :create]
+ resource :session, only: [:new, :create, :destroy]
+ resource :metadata, only: [:show]
+ root to: "sessions#new"
end