oxd-ruby 0.1.9 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/CHANGELOG.md +16 -0
- data/README.md +3 -241
- data/lib/generators/oxd/templates/oxd_config.rb +5 -5
- data/lib/oxd-ruby.rb +3 -1
- data/lib/oxd/client_oxd_commands.rb +96 -109
- data/lib/oxd/config.rb +17 -15
- data/lib/oxd/errors.rb +33 -0
- data/lib/oxd/oxd_connector.rb +51 -49
- data/lib/oxd/uma_commands.rb +72 -35
- data/lib/oxd/version.rb +2 -1
- data/oxd-ruby.gemspec +2 -2
- metadata +8 -72
- data/demosite/.gitignore +0 -17
- data/demosite/Gemfile +0 -50
- data/demosite/Gemfile.lock +0 -197
- data/demosite/README.md +0 -172
- data/demosite/Rakefile +0 -6
- data/demosite/app/assets/images/.keep +0 -0
- data/demosite/app/assets/javascripts/application.js +0 -17
- data/demosite/app/assets/javascripts/bootstrap.js.coffee +0 -3
- data/demosite/app/assets/stylesheets/application.css +0 -16
- data/demosite/app/assets/stylesheets/bootstrap_and_overrides.css +0 -7
- data/demosite/app/controllers/application_controller.rb +0 -46
- data/demosite/app/controllers/concerns/.keep +0 -0
- data/demosite/app/controllers/home_controller.rb +0 -79
- data/demosite/app/controllers/uma_controller.rb +0 -40
- data/demosite/app/helpers/application_helper.rb +0 -2
- data/demosite/app/mailers/.keep +0 -0
- data/demosite/app/models/.keep +0 -0
- data/demosite/app/models/concerns/.keep +0 -0
- data/demosite/app/views/home/index.html.erb +0 -210
- data/demosite/app/views/layouts/application.html.erb +0 -14
- data/demosite/app/views/uma/index.html.erb +0 -123
- data/demosite/bin/bundle +0 -3
- data/demosite/bin/rails +0 -9
- data/demosite/bin/rake +0 -9
- data/demosite/bin/setup +0 -29
- data/demosite/bin/spring +0 -15
- data/demosite/config.ru +0 -4
- data/demosite/config/application.rb +0 -26
- data/demosite/config/boot.rb +0 -3
- data/demosite/config/database.yml +0 -25
- data/demosite/config/environment.rb +0 -5
- data/demosite/config/environments/development.rb +0 -41
- data/demosite/config/environments/production.rb +0 -79
- data/demosite/config/environments/test.rb +0 -42
- data/demosite/config/initializers/assets.rb +0 -11
- data/demosite/config/initializers/backtrace_silencers.rb +0 -7
- data/demosite/config/initializers/cookies_serializer.rb +0 -3
- data/demosite/config/initializers/filter_parameter_logging.rb +0 -4
- data/demosite/config/initializers/inflections.rb +0 -16
- data/demosite/config/initializers/mime_types.rb +0 -4
- data/demosite/config/initializers/oxd_config.rb +0 -25
- data/demosite/config/initializers/session_store.rb +0 -3
- data/demosite/config/initializers/wrap_parameters.rb +0 -14
- data/demosite/config/locales/en.bootstrap.yml +0 -23
- data/demosite/config/locales/en.yml +0 -23
- data/demosite/config/routes.rb +0 -76
- data/demosite/config/secrets.yml +0 -22
- data/demosite/db/seeds.rb +0 -7
- data/demosite/lib/assets/.keep +0 -0
- data/demosite/lib/tasks/.keep +0 -0
- data/demosite/log/.keep +0 -0
- data/demosite/public/404.html +0 -67
- data/demosite/public/422.html +0 -67
- data/demosite/public/500.html +0 -66
- data/demosite/public/favicon.ico +0 -0
- data/demosite/public/robots.txt +0 -5
- data/demosite/test/controllers/.keep +0 -0
- data/demosite/test/fixtures/.keep +0 -0
- data/demosite/test/helpers/.keep +0 -0
- data/demosite/test/integration/.keep +0 -0
- data/demosite/test/mailers/.keep +0 -0
- data/demosite/test/models/.keep +0 -0
- data/demosite/test/test_helper.rb +0 -10
- data/demosite/vendor/assets/javascripts/.keep +0 -0
- data/demosite/vendor/assets/stylesheets/.keep +0 -0
data/demosite/Rakefile
DELETED
File without changes
|
@@ -1,17 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
-
// listed below.
|
3
|
-
//
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
-
//
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// compiled file.
|
9
|
-
//
|
10
|
-
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
-
// about supported directives.
|
12
|
-
//
|
13
|
-
//= require jquery
|
14
|
-
//= require jquery_ujs
|
15
|
-
//= require twitter/bootstrap
|
16
|
-
//= require turbolinks
|
17
|
-
//= require_tree .
|
@@ -1,16 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
-
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
-
* file per style scope.
|
12
|
-
*
|
13
|
-
*= require_tree .
|
14
|
-
*= require_self
|
15
|
-
*= require bootstrap_and_overrides
|
16
|
-
*/
|
@@ -1,46 +0,0 @@
|
|
1
|
-
class ApplicationController < ActionController::Base
|
2
|
-
# Prevent CSRF attacks by raising an exception.
|
3
|
-
# For APIs, you may want to use :null_session instead.
|
4
|
-
layout "application"
|
5
|
-
require 'resolv-replace'
|
6
|
-
require 'oxd-ruby'
|
7
|
-
protect_from_forgery with: :exception
|
8
|
-
|
9
|
-
before_filter :set_oxd_commands_instance
|
10
|
-
|
11
|
-
# method to set the client attributes taken from user
|
12
|
-
# It should be called before adding, updating and deleting client settings
|
13
|
-
def set_oxd_config_values(op_host, authorization_redirect_uri, post_logout_redirect_uri, client_name, connection_type, connection_type_value, client_id, client_secret)
|
14
|
-
@oxdConfig.op_host = op_host if(!op_host.nil?)
|
15
|
-
@oxdConfig.authorization_redirect_uri = authorization_redirect_uri if(!op_host.nil?)
|
16
|
-
@oxdConfig.post_logout_redirect_uri = post_logout_redirect_uri if(!post_logout_redirect_uri.nil?)
|
17
|
-
@oxdConfig.client_name = client_name if(!client_name.nil?)
|
18
|
-
@oxdConfig.connection_type = connection_type if(!connection_type.nil?)
|
19
|
-
@oxdConfig.oxd_host = connection_type_value if(!connection_type_value.nil?)
|
20
|
-
@oxdConfig.client_id = client_id if(!client_id.nil?)
|
21
|
-
@oxdConfig.client_secret = client_secret if(!client_secret.nil?)
|
22
|
-
end
|
23
|
-
|
24
|
-
# @return [Boolean] type for openID Provider type, True for dynamic and False for static openID provider
|
25
|
-
# method to know static or dynamic openID Provider
|
26
|
-
# This should be called after getting the URI of the OpenID Provider, Client Redirect URI, Post logout URI, oxd port values from user
|
27
|
-
def check_openid_type(op_host)
|
28
|
-
op_host = op_host+"/.well-known/openid-configuration"
|
29
|
-
uri = URI.parse(op_host)
|
30
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
31
|
-
http.use_ssl = true
|
32
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
33
|
-
request = Net::HTTP::Get.new(uri.request_uri)
|
34
|
-
response = http.request(request)
|
35
|
-
ophost_data = response.body
|
36
|
-
@oxdConfig.dynamic_registration = (!JSON.parse(ophost_data).key?("registration_endpoint"))? false : true
|
37
|
-
@oxdConfig.scope = ["openid", "profile", "email"] if(@oxdConfig.dynamic_registration == false)
|
38
|
-
end
|
39
|
-
|
40
|
-
protected
|
41
|
-
def set_oxd_commands_instance
|
42
|
-
@oxd_command = Oxd::ClientOxdCommands.new
|
43
|
-
@uma_command = Oxd::UMACommands.new
|
44
|
-
@oxdConfig = @oxd_command.oxdConfig
|
45
|
-
end
|
46
|
-
end
|
File without changes
|
@@ -1,79 +0,0 @@
|
|
1
|
-
class HomeController < ApplicationController
|
2
|
-
skip_before_filter :verify_authenticity_token
|
3
|
-
|
4
|
-
def index
|
5
|
-
end
|
6
|
-
|
7
|
-
def setup_client
|
8
|
-
unless(@oxdConfig.oxd_id.present?)
|
9
|
-
check_openid_type(@oxdConfig.op_host)
|
10
|
-
|
11
|
-
if(@oxdConfig.dynamic_registration == false && (@oxdConfig.client_id.nil? && @oxdConfig.client_secret.nil?))
|
12
|
-
flash[:info] = 'Enter client ID and client Secret in oxd_config.rb file'
|
13
|
-
else
|
14
|
-
@oxd_command.setup_client
|
15
|
-
end
|
16
|
-
end
|
17
|
-
flash[:success] = 'Client is registered with Oxd ID : '+@oxdConfig.oxd_id
|
18
|
-
redirect_to root_path
|
19
|
-
end
|
20
|
-
|
21
|
-
def get_client_token
|
22
|
-
@oxd_command.get_client_token # Fetch protection_access_token
|
23
|
-
redirect_to root_path
|
24
|
-
end
|
25
|
-
|
26
|
-
def register_site
|
27
|
-
if(!@oxdConfig.oxd_id.present?)
|
28
|
-
@oxd_command.register_site # Register site and store the returned oxd_id in config
|
29
|
-
end
|
30
|
-
authorization_url = @oxd_command.get_authorization_url([],[], {"param1" => "value1","param2" => "value2"})
|
31
|
-
redirect_to authorization_url # redirect user to obtained authorization_url to authenticate
|
32
|
-
end
|
33
|
-
|
34
|
-
def login
|
35
|
-
if(@oxdConfig.oxd_id.present?)
|
36
|
-
if (params[:code].present?)
|
37
|
-
# pass the parameters obtained from callback url to get access_token
|
38
|
-
@access_token = @oxd_command.get_tokens_by_code( params[:code], params[:state])
|
39
|
-
end
|
40
|
-
session.delete('oxd_access_token') if(session[:oxd_access_token].present?)
|
41
|
-
|
42
|
-
if(@oxdConfig.dynamic_registration == true)
|
43
|
-
@access_token = @oxd_command.get_access_token_by_refresh_token
|
44
|
-
end
|
45
|
-
session[:oxd_access_token] = @access_token
|
46
|
-
session[:state] = params[:state]
|
47
|
-
session[:session_state] = params[:session_state]
|
48
|
-
@user = @oxd_command.get_user_info(session[:oxd_access_token]) # pass access_token get user information from OP
|
49
|
-
render :template => "home/index", :locals => { :user => @user }
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def update_registration
|
54
|
-
@oxdConfig.client_name = "ClienName 2"
|
55
|
-
if(@oxd_command.update_site_registration)
|
56
|
-
flash[:success] = 'Client settings are updated successfully!!'
|
57
|
-
else
|
58
|
-
flash[:error] = 'There was some error in updating Client settings'
|
59
|
-
end
|
60
|
-
redirect_to root_path
|
61
|
-
end
|
62
|
-
|
63
|
-
def logout
|
64
|
-
# get logout url and redirect user that URL to logout from OP
|
65
|
-
if(session[:oxd_access_token])
|
66
|
-
@logout_url = @oxd_command.get_logout_uri(session[:state], session[:session_state])
|
67
|
-
redirect_to @logout_url
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def clear_data
|
72
|
-
@oxdConfig.oxd_id = ""
|
73
|
-
@oxdConfig.client_id = "";
|
74
|
-
@oxdConfig.client_secret = "";
|
75
|
-
@oxdConfig.client_name = "";
|
76
|
-
@oxdConfig.protection_access_token = "";
|
77
|
-
redirect_to root_path
|
78
|
-
end
|
79
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
class UmaController < ApplicationController
|
2
|
-
skip_before_filter :verify_authenticity_token
|
3
|
-
require 'json'
|
4
|
-
|
5
|
-
def index
|
6
|
-
end
|
7
|
-
|
8
|
-
def get_client_token
|
9
|
-
@oxd_command.get_client_token
|
10
|
-
redirect_to uma_index_path
|
11
|
-
end
|
12
|
-
|
13
|
-
def protect_resources
|
14
|
-
condition1_for_path1 = {:httpMethods => ["GET"], :scopes => ["https://scim-test.gluu.org/identity/seam/resource/restv1/scim/vas1/view"]}
|
15
|
-
condition2_for_path1 = {:httpMethods => ["PUT", "POST"], :scopes => ["https://scim-test.gluu.org/identity/seam/resource/restv1/scim/vas1/all","https://scim-test.gluu.org/identity/seam/resource/restv1/scim/vas1/add"], :ticketScopes => ["https://scim-test.gluu.org/identity/seam/resource/restv1/scim/vas1/add"]}
|
16
|
-
|
17
|
-
condition1_for_path2 = {:httpMethods => ["GET"], :scopes => ["https://scim-test.gluu.org/identity/seam/resource/restv1/scim/vas1/all"]}
|
18
|
-
|
19
|
-
@uma_command.uma_add_resource("/photo", condition1_for_path1, condition2_for_path1) # Add Resource#1
|
20
|
-
@uma_command.uma_add_resource("/document", condition1_for_path2) # Add Resource#2
|
21
|
-
|
22
|
-
response = @uma_command.uma_rs_protect # Register above resources with UMA RS
|
23
|
-
render :template => "uma/index", :locals => { :protect_resources_response => response }
|
24
|
-
end
|
25
|
-
|
26
|
-
def get_rpt
|
27
|
-
response = @uma_command.uma_rp_get_rpt
|
28
|
-
render :template => "uma/index", :locals => { :get_rpt_response => response }
|
29
|
-
end
|
30
|
-
|
31
|
-
def check_access
|
32
|
-
response = @uma_command.uma_rs_check_access('/photo', 'GET') # Pass the resource path and http method to check access
|
33
|
-
render :template => "uma/index", :locals => { :check_access_response => response }
|
34
|
-
end
|
35
|
-
|
36
|
-
def get_claims_gathering_url
|
37
|
-
response = @uma_command.uma_rp_get_claims_gathering_url('/photo')
|
38
|
-
render :template => "uma/index", :locals => { :get_claims_gathering_url_response => response }
|
39
|
-
end
|
40
|
-
end
|
data/demosite/app/mailers/.keep
DELETED
File without changes
|
data/demosite/app/models/.keep
DELETED
File without changes
|
File without changes
|
@@ -1,210 +0,0 @@
|
|
1
|
-
<div class="jumbotron">
|
2
|
-
<h2>Ruby on Rails demo Site for OxD Ruby Library</h2>
|
3
|
-
<p>This is a demo site showcasing the usage of OxD Ruby Library. The demo site is written in Ruby on Rails and shows that the library can be used to perform OpenID based authentication.</p>
|
4
|
-
</div>
|
5
|
-
|
6
|
-
<% flash.each do |key, value| %>
|
7
|
-
<div class="alert alert-<%= key %>"><%= value %></div>
|
8
|
-
<% end %>
|
9
|
-
|
10
|
-
<div class="row">
|
11
|
-
<div class="col-md-6">
|
12
|
-
<h3>Setup Client</h3>
|
13
|
-
<p>
|
14
|
-
In order to use an OpenID Connect Provider (OP) for login, you need to setup your client application at the OP. During setup oxd will dynamically register the OpenID Connect client and save its configuration. Upon successful setup a unique identifier will be issued by the oxd server by assigning a specific oxd id. Along with oxd Id oxd server will also return client Id and client secret. This client Id and client secret can be used for <code>get_client_token</code> method. The Setup Client method is a one time task to configure a client in the oxd server and OP.
|
15
|
-
</p>
|
16
|
-
<b>Note:</b> If your OpenID Connect Provider does not support dynamic registration (like Google), you will need to obtain a ClientID and Client Secret which can be set in <code>oxd_config.rb</code> initializer file.
|
17
|
-
<hr>
|
18
|
-
<% if @oxdConfig.oxd_id.present? %>
|
19
|
-
<div class="alert alert-success">
|
20
|
-
Client is registered with Oxd ID : <%= @oxdConfig.oxd_id %>
|
21
|
-
</div>
|
22
|
-
<p><strong> Clear Saved Client configuration - </strong><a class="btn btn-primary" href="<%= clear_data_path %>" >Clear data</a></p>
|
23
|
-
<% else %>
|
24
|
-
<p><strong> Live demo - </strong><a class="btn btn-primary" href="<%= setup_client_path %>" >Setup Client</a></p>
|
25
|
-
<% end %>
|
26
|
-
</div>
|
27
|
-
<div class="col-md-6">
|
28
|
-
<pre class="prettyprint">
|
29
|
-
def setup_client
|
30
|
-
unless(@oxdConfig.oxd_id.present?)
|
31
|
-
check_openid_type(@oxdConfig.op_host)
|
32
|
-
|
33
|
-
if(@oxdConfig.dynamic_registration == false && (@oxdConfig.client_id.nil? && @oxdConfig.client_secret.nil?))
|
34
|
-
flash[:info] = 'Enter client ID and client Secret in oxd_config.rb file'
|
35
|
-
else
|
36
|
-
@oxd_command.setup_client
|
37
|
-
end
|
38
|
-
end
|
39
|
-
flash[:success] = 'Client is registered with Oxd ID : '+@oxdConfig.oxd_id
|
40
|
-
redirect_to root_path
|
41
|
-
end
|
42
|
-
</pre>
|
43
|
-
</div>
|
44
|
-
</div>
|
45
|
-
<div class="row">
|
46
|
-
<div class="col-md-6">
|
47
|
-
<h3>Get Client Token and Login to Open Id</h3>
|
48
|
-
<p>Once the client is registered, then the user data can be fetched upon user authorization. <code>get_client_token</code> command must be invoked to use all other methods of API when the <code>protect_commands_with_access_token</code> is enabled in oxd-server.
|
49
|
-
oxD Ruby performs client registration automatically when you request for an authorization url. Redirect the user to the authorization url to get user consent.</p>
|
50
|
-
<hr>
|
51
|
-
<% if @oxdConfig.oxd_id.present? %>
|
52
|
-
<% if @oxdConfig.protection_access_token.present? %>
|
53
|
-
<div class="alert alert-success">
|
54
|
-
Obtained protection access token is : <%= @oxdConfig.protection_access_token %>
|
55
|
-
</div>
|
56
|
-
<p><strong>Login with Open ID Live demo - </strong><a class="btn btn-primary" href="<%= register_site_path %>" >Login with Open ID</a></p>
|
57
|
-
<% else %>
|
58
|
-
<p><strong>Get Client Token Live demo - </strong><a class="btn btn-primary" href="<%= get_client_token_path %>" >Get Client Token</a></p>
|
59
|
-
<% end %>
|
60
|
-
<% end %>
|
61
|
-
</div>
|
62
|
-
<div class="col-md-6">
|
63
|
-
<pre class="prettyprint">
|
64
|
-
def get_client_token
|
65
|
-
@oxd_command.get_client_token
|
66
|
-
redirect_to root_path
|
67
|
-
end
|
68
|
-
|
69
|
-
def register_site
|
70
|
-
if(!@oxd_command.getOxdId.present?)
|
71
|
-
@oxd_command.register_site
|
72
|
-
end
|
73
|
-
authorization_url = @oxd_command.get_authorization_url
|
74
|
-
redirect_to authorization_url
|
75
|
-
end
|
76
|
-
</pre>
|
77
|
-
</div>
|
78
|
-
</div>
|
79
|
-
<div class="row">
|
80
|
-
<div class="col-md-6">
|
81
|
-
<h3>Get user information</h3>
|
82
|
-
<p>Once the user authorizes the website to use the information from the OP, the OP calls back the website with code and scopes for accessing the user data in the registered callback <code>authorization_redirect_uri</code> in the config file. Then an access token is obtained from the OP using <code>get_tokens_by_code</code> command with which user claims can be requested.</p>
|
83
|
-
<p>The <code>get_access_token_by_refresh_token</code> method can be used to get a fresh access token and refresh token by using the refresh token which is obtained from <code>get_tokens_by_code</code> method. The newly obtained access token can be used with <code>get_user_info</code> command to fetch user claims.
|
84
|
-
</p>
|
85
|
-
</div>
|
86
|
-
<div class="col-md-6">
|
87
|
-
<pre class="prettyprint">
|
88
|
-
def login
|
89
|
-
if(@oxdConfig.oxd_id.present?)
|
90
|
-
if (params[:code].present?)
|
91
|
-
@access_token = @oxd_command.get_tokens_by_code( params[:code], params[:state])
|
92
|
-
end
|
93
|
-
session.delete('oxd_access_token') if(session[:oxd_access_token].present?)
|
94
|
-
if(@oxdConfig.dynamic_registration == true)
|
95
|
-
@access_token = @oxd_command.get_access_token_by_refresh_token
|
96
|
-
end
|
97
|
-
session[:oxd_access_token] = @access_token
|
98
|
-
session[:state] = params[:state]
|
99
|
-
session[:session_state] = params[:session_state]
|
100
|
-
@user = @oxd_command.get_user_info(session[:oxd_access_token]) # pass access_token get user information from OP
|
101
|
-
render :template => "home/index", :locals => { :user => @user }
|
102
|
-
end
|
103
|
-
end
|
104
|
-
</pre>
|
105
|
-
</div>
|
106
|
-
</div>
|
107
|
-
<div class="row">
|
108
|
-
<div class="col-md-6">
|
109
|
-
<h3>Using the user claims</h3>
|
110
|
-
<p>Once the user data is obtained, the various claims supported by the OP can be used as required.</p>
|
111
|
-
<% if defined?(user) %>
|
112
|
-
<div class="alert alert-success">
|
113
|
-
<% user.each do |field,value| %>
|
114
|
-
<%= "#{field} : #{value}" %>
|
115
|
-
<br>
|
116
|
-
<% end %>
|
117
|
-
</div>
|
118
|
-
<% else %>
|
119
|
-
<div class="alert alert-warning">No business card for you. You haven't authorized the demo user yet.</div>
|
120
|
-
<% end %>
|
121
|
-
</div>
|
122
|
-
<div class="col-md-6">
|
123
|
-
<h3>Template code</h3>
|
124
|
-
<pre class="prettyprint">
|
125
|
-
if defined?(user)
|
126
|
-
<div class="alert alert-success">
|
127
|
-
user.each do |field,value|
|
128
|
-
"#{field} : #{value}"
|
129
|
-
<br>
|
130
|
-
end
|
131
|
-
</div>
|
132
|
-
end
|
133
|
-
</pre>
|
134
|
-
</div>
|
135
|
-
</div>
|
136
|
-
<div class="row">
|
137
|
-
<div class="col-md-6">
|
138
|
-
<h3>Update webiste registration</h3>
|
139
|
-
<p>The <code>update_site_registration</code> method can be used to update an existing client in the OpenID Connect Provider (OP). Fields like Authorization Redirect URL, Post Logout URL, Scope, Client Secret and other fields can be updated using this method.</p>
|
140
|
-
<% if(@oxdConfig.oxd_id.present? && @oxdConfig.protection_access_token.present?) %>
|
141
|
-
<p><strong>Update webiste registration Live demo. </strong><a class="btn btn-primary" href="<%= update_registration_path %>">Update</a></p>
|
142
|
-
<% else %>
|
143
|
-
<div class="alert alert-warning">No business card for you. Obtain OxdID and Protection Access Token first</div>
|
144
|
-
<% end %>
|
145
|
-
</div>
|
146
|
-
<div class="col-md-6">
|
147
|
-
<pre class="prettyprint">
|
148
|
-
def update_registration
|
149
|
-
@oxdConfig.client_name = "ClienName 2"
|
150
|
-
if(@oxd_command.update_site_registration)
|
151
|
-
flash[:success] = 'Client settings are updated successfully!!'
|
152
|
-
else
|
153
|
-
flash[:error] = 'There was some error in updating Client settings'
|
154
|
-
end
|
155
|
-
redirect_to root_path
|
156
|
-
end
|
157
|
-
</pre>
|
158
|
-
</div>
|
159
|
-
</div>
|
160
|
-
<div class="row">
|
161
|
-
<div class="col-md-6">
|
162
|
-
<h3>UMA Demo</h3>
|
163
|
-
<p>UMA defines how resource owners can control protected-resource access by clients operated by arbitrary requesting parties.Once the website has been registered and authorized with OP you can register protection document with UMA.</p>
|
164
|
-
<% if(@oxdConfig.oxd_id.present? && @oxdConfig.protection_access_token.present?) %>
|
165
|
-
<p><strong> Live demo. </strong><a class="btn btn-primary" href="<%= uma_index_path %>" target="_blank">Go to UMA demo page</a></p>
|
166
|
-
<% else %>
|
167
|
-
<div class="alert alert-warning">No business card for you. Obtain OxdID and Protection Access Token first</div>
|
168
|
-
<% end %>
|
169
|
-
</div>
|
170
|
-
</div>
|
171
|
-
<div class="row">
|
172
|
-
<div class="col-md-6">
|
173
|
-
<h3>Logging Out</h3>
|
174
|
-
<p>Once the required work is done the user can be logged out of the system.</p>
|
175
|
-
<a class="btn btn-danger" href="<%= logout_path %>">Logout</a>
|
176
|
-
</div>
|
177
|
-
<div class="col-md-6">
|
178
|
-
<pre class="prettyprint">
|
179
|
-
def logout
|
180
|
-
if(session[:oxd_access_token])
|
181
|
-
@logout_url = @oxd_command.get_logout_uri(session[:state], session[:session_state])
|
182
|
-
redirect_to @logout_url
|
183
|
-
end
|
184
|
-
end
|
185
|
-
</pre>
|
186
|
-
</div>
|
187
|
-
</div>
|
188
|
-
|
189
|
-
<script type="text/javascript">
|
190
|
-
$(document).ready(function() {
|
191
|
-
|
192
|
-
<% if @oxdConfig.oxd_id.present? %>
|
193
|
-
$('.disabled').attr('disabled',true);
|
194
|
-
<% if @oxdConfig.dynamic_registration == true %>
|
195
|
-
$('.dynamic_registration_disabled').attr('disabled',true);
|
196
|
-
<% end %>
|
197
|
-
<% end %>
|
198
|
-
|
199
|
-
$('input[name=connection_type]').on('change', function(){
|
200
|
-
var checked_btn = $(this).val();
|
201
|
-
$('.connection_type_value').addClass('hidden');
|
202
|
-
$('.'+checked_btn+'_connection_type').removeClass('hidden');
|
203
|
-
});
|
204
|
-
|
205
|
-
$('#login').on('click', function(evt){
|
206
|
-
evt.preventDefault();
|
207
|
-
window.location = '<%= register_site_path %>';
|
208
|
-
});
|
209
|
-
});
|
210
|
-
</script>
|