oxd-ruby 0.1.3
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 +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +116 -0
- data/Rakefile +7 -0
- data/demosite/.gitignore +17 -0
- data/demosite/Gemfile +49 -0
- data/demosite/Gemfile.lock +190 -0
- data/demosite/README.md +172 -0
- data/demosite/Rakefile +6 -0
- data/demosite/app/assets/images/.keep +0 -0
- data/demosite/app/assets/javascripts/application.js +17 -0
- data/demosite/app/assets/javascripts/bootstrap.js.coffee +3 -0
- data/demosite/app/assets/stylesheets/application.css +16 -0
- data/demosite/app/assets/stylesheets/bootstrap_and_overrides.css +7 -0
- data/demosite/app/controllers/application_controller.rb +14 -0
- data/demosite/app/controllers/concerns/.keep +0 -0
- data/demosite/app/controllers/home_controller.rb +38 -0
- data/demosite/app/helpers/application_helper.rb +2 -0
- 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 +127 -0
- data/demosite/app/views/layouts/application.html.erb +14 -0
- data/demosite/bin/bundle +3 -0
- data/demosite/bin/rails +9 -0
- data/demosite/bin/rake +9 -0
- data/demosite/bin/setup +29 -0
- data/demosite/bin/spring +15 -0
- data/demosite/config.ru +4 -0
- data/demosite/config/application.rb +26 -0
- data/demosite/config/boot.rb +3 -0
- data/demosite/config/database.yml +25 -0
- data/demosite/config/environment.rb +5 -0
- data/demosite/config/environments/development.rb +41 -0
- data/demosite/config/environments/production.rb +79 -0
- data/demosite/config/environments/test.rb +42 -0
- data/demosite/config/initializers/assets.rb +11 -0
- data/demosite/config/initializers/backtrace_silencers.rb +7 -0
- data/demosite/config/initializers/cookies_serializer.rb +3 -0
- data/demosite/config/initializers/filter_parameter_logging.rb +4 -0
- data/demosite/config/initializers/inflections.rb +16 -0
- data/demosite/config/initializers/mime_types.rb +4 -0
- data/demosite/config/initializers/oxd_config.rb +19 -0
- data/demosite/config/initializers/session_store.rb +3 -0
- data/demosite/config/initializers/wrap_parameters.rb +14 -0
- data/demosite/config/locales/en.bootstrap.yml +23 -0
- data/demosite/config/locales/en.yml +23 -0
- data/demosite/config/routes.rb +62 -0
- data/demosite/config/secrets.yml +22 -0
- data/demosite/db/seeds.rb +7 -0
- 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 +67 -0
- data/demosite/public/422.html +67 -0
- data/demosite/public/500.html +66 -0
- data/demosite/public/favicon.ico +0 -0
- data/demosite/public/robots.txt +5 -0
- 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 +10 -0
- data/demosite/vendor/assets/javascripts/.keep +0 -0
- data/demosite/vendor/assets/stylesheets/.keep +0 -0
- data/lib/generators/oxd/config_generator.rb +22 -0
- data/lib/generators/oxd/templates/oxd_config.rb +19 -0
- data/lib/oxd-ruby.rb +11 -0
- data/lib/oxd/client_oxd_commands.rb +147 -0
- data/lib/oxd/config.rb +94 -0
- data/lib/oxd/oxd_connector.rb +133 -0
- data/lib/oxd/version.rb +4 -0
- data/oxd-ruby.gemspec +24 -0
- metadata +180 -0
data/demosite/README.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# oxD Ruby Demo site
|
|
2
|
+
|
|
3
|
+
This is a demo site for oxd-ruby written using Ruby and Rails to demonstrate how to use oxd-ruby to perform authorization with an OpenID Provider and fetch information.
|
|
4
|
+
|
|
5
|
+
## Deployment
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
Ubuntu 14.04 with some basic utilities listed below
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
$ sudo apt-get install apache2
|
|
13
|
+
$ a2enmod ssl
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Installing and configuring the oxd-server
|
|
17
|
+
You can download the oxd-server and follow the installation instructions from [here](https://www.gluu.org/docs-oxd)
|
|
18
|
+
|
|
19
|
+
## Demosite deployment
|
|
20
|
+
|
|
21
|
+
OpenID Connect works only with HTTPS connections. So let us get the ssl certs ready.
|
|
22
|
+
```bash
|
|
23
|
+
$ mkdir /etc/certs
|
|
24
|
+
$ cd /etc/certs
|
|
25
|
+
$ openssl genrsa -des3 -out demosite.key 2048
|
|
26
|
+
$ openssl rsa -in demosite.key -out demosite.key.insecure
|
|
27
|
+
$ mv demosite.key.insecure demosite.key
|
|
28
|
+
$ openssl req -new -key demosite.key -out demosite.csr
|
|
29
|
+
$ openssl x509 -req -days 365 -in demosite.csr -signkey demosite.key -out demosite.crt
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
###Install RVM and Ruby on ubuntu
|
|
33
|
+
|
|
34
|
+
Install mpapis public key first (might need gpg2)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
$ sudo gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Install RVM stable with ruby:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
$ sudo \curl -sSL https://get.rvm.io | bash -s stable --ruby
|
|
44
|
+
$ cd /var/www/html
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Reload shell configuration & test
|
|
48
|
+
```bash
|
|
49
|
+
$ source ~/.rvm/scripts/rvm
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Run this command in terminal to get list of installed ruby versions on your system
|
|
53
|
+
```bash
|
|
54
|
+
$ rvm list
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Using rvm you can install specific ruby version. E.g. for ruby-2.2.0 :
|
|
58
|
+
```bash
|
|
59
|
+
$ rvm install ruby-2.2.0
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
To change ruby version simply run this command. E.g. to switch to ruby-2.2.0 :
|
|
63
|
+
```bash
|
|
64
|
+
$ rvm use ruby-2.2.0
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Rails is distributed as a Ruby gem and adding it to the local system is extremely simple:
|
|
68
|
+
```bash
|
|
69
|
+
$ gem install rails
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
For more help you can see rvm commands here :
|
|
73
|
+
https://rvm.io/rvm/install
|
|
74
|
+
|
|
75
|
+
###Phusion Passenger Setup
|
|
76
|
+
|
|
77
|
+
Phusion Passenger (commonly shortened to Passenger or referred to as mod_passenger) is an application server and it is often used to power Ruby sites. Its code is distributed in form of a Ruby gem, which is then compiled on the target machine and installed into Apache as a module.
|
|
78
|
+
|
|
79
|
+
First, the gem needs to be installed on the system:
|
|
80
|
+
```bash
|
|
81
|
+
$ gem install passenger
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The environment is now ready for the compilation. The process takes a few minutes and it’s started by the following command:
|
|
85
|
+
```bash
|
|
86
|
+
$ passenger-install-apache2-module
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Note that this script will not install the module really. It will compile module’s binary and place it under gem’s path. The path will be printed on screen and it needs to be copy-pasted into Apache’s config file
|
|
90
|
+
|
|
91
|
+
The output will be similar to this one:
|
|
92
|
+
```
|
|
93
|
+
LoadModule passenger_module /home/username/.rvm/gems/ruby-2.2.1/gems/passenger-5.0.28/buildout/apache2/mod_passenger.so
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Then in Apache's config file add these lines :
|
|
97
|
+
```
|
|
98
|
+
<IfModule mod_passenger.c>
|
|
99
|
+
PassengerRoot /home/username/.rvm/gems/ruby-2.2.1/gems/passenger-5.0.28
|
|
100
|
+
PassengerDefaultRuby /home/username/.rvm/gems/ruby-2.2.1/wrappers/ruby
|
|
101
|
+
</IfModule>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
In console :
|
|
105
|
+
```bash
|
|
106
|
+
$ sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/oxd-ruby.conf
|
|
107
|
+
$ sudo vi /etc/apache2/sites-available/oxd-ruby.conf
|
|
108
|
+
```
|
|
109
|
+
Replace the content of oxd-ruby.conf file with following:
|
|
110
|
+
```
|
|
111
|
+
<IfModule mod_ssl.c>
|
|
112
|
+
<VirtualHost *:443>
|
|
113
|
+
ServerAdmin webmaster@localhost
|
|
114
|
+
ServerName oxd-rails.com
|
|
115
|
+
DocumentRoot /var/www/html/oxdrails
|
|
116
|
+
|
|
117
|
+
LogLevel info ssl:warn
|
|
118
|
+
ErrorLog ${APACHE_LOG_DIR}/error.log
|
|
119
|
+
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
|
120
|
+
|
|
121
|
+
# SSL Engine Switch:
|
|
122
|
+
# Enable/Disable SSL for this virtual host.
|
|
123
|
+
SSLEngine on
|
|
124
|
+
SSLCertificateFile /etc/certs/demosite.crt
|
|
125
|
+
SSLCertificateKeyFile /etc/certs/demosite.key
|
|
126
|
+
|
|
127
|
+
<Directory /var/www/html/oxdrails>
|
|
128
|
+
AllowOverride All
|
|
129
|
+
Options Indexes FollowSymLinks
|
|
130
|
+
Order allow,deny
|
|
131
|
+
Allow from all
|
|
132
|
+
</Directory>
|
|
133
|
+
</VirtualHost>
|
|
134
|
+
</IfModule>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Then enable `oxd-rails.com` virtual host by running:
|
|
138
|
+
```bash
|
|
139
|
+
$ sudo a2ensite oxd-ruby.conf
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
After that add domain name in virtual host file.
|
|
143
|
+
In console:
|
|
144
|
+
```bash
|
|
145
|
+
$ sudo nano /etc/hosts
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Add these lines in virtual host file:
|
|
149
|
+
```
|
|
150
|
+
127.0.0.1 www.oxd-rails.com
|
|
151
|
+
127.0.0.1 oxd-rails.com
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Reload the apache server
|
|
155
|
+
```bash
|
|
156
|
+
$ sudo service apache2 restart
|
|
157
|
+
```
|
|
158
|
+
### Setting up and running demo app
|
|
159
|
+
|
|
160
|
+
Navigate to Rails app root:
|
|
161
|
+
```bash
|
|
162
|
+
cd /var/www/html/oxdrails
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Run :
|
|
166
|
+
```bash
|
|
167
|
+
bundle install
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Now your rails app should work from http://oxd-rails.com
|
|
171
|
+
|
|
172
|
+
##Enjoy!
|
data/demosite/Rakefile
ADDED
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
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 .
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
protected
|
|
11
|
+
def set_oxd_commands_instance
|
|
12
|
+
@oxd_command = Oxd::ClientOxdCommands.new
|
|
13
|
+
end
|
|
14
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
class HomeController < ApplicationController
|
|
2
|
+
skip_before_filter :verify_authenticity_token
|
|
3
|
+
|
|
4
|
+
def index
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def register_site
|
|
8
|
+
if(!@oxd_command.getOxdId.present?)
|
|
9
|
+
@oxd_command.register_site # Register site and store the returned oxd_id in config
|
|
10
|
+
end
|
|
11
|
+
authorization_url = @oxd_command.get_authorization_url
|
|
12
|
+
redirect_to authorization_url # redirect user to obtained authorization_url to authenticate
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def login
|
|
16
|
+
if(@oxd_command.getOxdId.present?)
|
|
17
|
+
if (params[:code].present? && params[:state].present?)
|
|
18
|
+
scopes = params[:scope].split("+")
|
|
19
|
+
# pass the parameters obtained from callback url to get access_token
|
|
20
|
+
@access_token = @oxd_command.get_tokens_by_code( params[:code], scopes, params[:state])
|
|
21
|
+
end
|
|
22
|
+
session.delete('oxd_access_token') if(session[:oxd_access_token].present?)
|
|
23
|
+
session[:oxd_access_token] = @access_token
|
|
24
|
+
session[:state] = params[:state]
|
|
25
|
+
session[:session_state] = params[:session_state]
|
|
26
|
+
@user = @oxd_command.get_user_info(session[:oxd_access_token]) # pass access_token get user information from OP
|
|
27
|
+
render :template => "home/index", :locals => { :user => @user }
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def logout
|
|
32
|
+
# get logout url and redirect user that URL to logout from OP
|
|
33
|
+
if(session[:oxd_access_token])
|
|
34
|
+
@logout_url = @oxd_command.get_logout_uri(session[:oxd_access_token], session[:state], session[:session_state])
|
|
35
|
+
redirect_to @logout_url
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,127 @@
|
|
|
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
|
+
<div class="row">
|
|
6
|
+
<div class="col-md-6">
|
|
7
|
+
<h3>Configuration File</h3>
|
|
8
|
+
<p>Website specific configuration information is stored in a config file. This is necessary for storing persistant information like Oxd ID generated during the site registration with the Open ID provider.
|
|
9
|
+
The <code>oxd_config.rb</code> shows the config file used for this demo app. The complete documentation about the config file can be obtained <a href="https://github.com/GluuFederation/oxd-ruby">here in Github</a>
|
|
10
|
+
</p>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="col-md-6">
|
|
13
|
+
<h3>oxd_config.rb</h3>
|
|
14
|
+
<pre class="prettyprint">
|
|
15
|
+
Oxd.configure do |config|
|
|
16
|
+
config.oxd_host_ip = '127.0.0.1'
|
|
17
|
+
config.oxd_host_port = 8099
|
|
18
|
+
config.authorization_redirect_uri = "https://domain.example.com/login"
|
|
19
|
+
config.logout_redirect_uri = "https://domain.example.com/logout"
|
|
20
|
+
config.post_logout_redirect_uri = "https://domain.example.com/"
|
|
21
|
+
config.scope = [ "openid", "profile" ]
|
|
22
|
+
config.application_type = "web"
|
|
23
|
+
config.redirect_uris = ["https://domain.example.com/login"]
|
|
24
|
+
config.client_jwks_uri = ""
|
|
25
|
+
config.client_token_endpoint_auth_method = ""
|
|
26
|
+
config.client_request_uris = []
|
|
27
|
+
config.contacts = ["example-email@gmail.com"]
|
|
28
|
+
config.grant_types = []
|
|
29
|
+
config.response_types = ["code"]
|
|
30
|
+
config.acr_values = [ "basic" ]
|
|
31
|
+
config.client_logout_uris = ['https://domain.example.com/logout']
|
|
32
|
+
end
|
|
33
|
+
</pre>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="row">
|
|
37
|
+
<div class="col-md-6">
|
|
38
|
+
<h3>Registration and Fetching Auth URL</h3>
|
|
39
|
+
<p>The first step is to register the client with the OP. Once the client is registered, then the user data can be fetched upon user authorization.
|
|
40
|
+
oxD Ruby performs client registration automatically when you request for an authorization url. Redirect the user to the authorization url to get user
|
|
41
|
+
consent.</p>
|
|
42
|
+
<hr>
|
|
43
|
+
<p><strong> Live demo. </strong><a class="btn btn-primary" href="<%= register_site_path %>">Go to Authorization Page</a></p>
|
|
44
|
+
</div>
|
|
45
|
+
<div class="col-md-6">
|
|
46
|
+
<pre class="prettyprint">
|
|
47
|
+
def register_site
|
|
48
|
+
if(!@oxd_command.getOxdId.present?)
|
|
49
|
+
@oxd_command.register_site
|
|
50
|
+
end
|
|
51
|
+
authorization_url = @oxd_command.get_authorization_url
|
|
52
|
+
redirect_to authorization_url
|
|
53
|
+
end
|
|
54
|
+
</pre>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
<div class="row">
|
|
58
|
+
<div class="col-md-6">
|
|
59
|
+
<h3>Get user information</h3>
|
|
60
|
+
<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 which user claims can be requested.</p>
|
|
61
|
+
</div>
|
|
62
|
+
<div class="col-md-6">
|
|
63
|
+
<pre class="prettyprint">
|
|
64
|
+
def login
|
|
65
|
+
if(@oxd_command.getOxdId.present?)
|
|
66
|
+
if (params[:code].present? && params[:state].present?)
|
|
67
|
+
scopes = params[:scope].split("+")
|
|
68
|
+
@access_token = @oxd_command.get_tokens_by_code( params[:code], scopes, params[:state])
|
|
69
|
+
end
|
|
70
|
+
session.delete('oxd_access_token') if(session[:oxd_access_token].present?)
|
|
71
|
+
session[:oxd_access_token] = @access_token
|
|
72
|
+
session[:state] = params[:state]
|
|
73
|
+
session[:session_state] = params[:session_state]
|
|
74
|
+
@user = @oxd_command.get_user_info(session[:oxd_access_token])
|
|
75
|
+
render :template => "home/index", :locals => { :user => @user }
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
</pre>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
<div class="row">
|
|
82
|
+
<div class="col-md-6">
|
|
83
|
+
<h3>Using the user claims</h3>
|
|
84
|
+
<p>Once the user data is obtained, the various claims supported by the OP can be used as required.</p>
|
|
85
|
+
<% if defined?(user) %>
|
|
86
|
+
<div class="alert alert-success">
|
|
87
|
+
<% user.each do |field,value| %>
|
|
88
|
+
<%= "#{field} : #{value}" %>
|
|
89
|
+
<br>
|
|
90
|
+
<% end %>
|
|
91
|
+
</div>
|
|
92
|
+
<% else %>
|
|
93
|
+
<div class="alert alert-warning">No business card for you. You haven't authorized the demo user yet.</div>
|
|
94
|
+
<% end %>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="col-md-6">
|
|
97
|
+
<h3>Template code</h3>
|
|
98
|
+
<pre class="prettyprint">
|
|
99
|
+
if defined?(user)
|
|
100
|
+
<div class="alert alert-success">
|
|
101
|
+
user.each do |field,value|
|
|
102
|
+
"#{field} : #{value}"
|
|
103
|
+
<br>
|
|
104
|
+
end
|
|
105
|
+
</div>
|
|
106
|
+
end
|
|
107
|
+
</pre>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<div class="row">
|
|
112
|
+
<div class="col-md-6">
|
|
113
|
+
<h3>Logging Out</h3>
|
|
114
|
+
<p>Once the required work is done the user can be logged out of the system.</p>
|
|
115
|
+
<a class="btn btn-danger" href="<%= logout_path %>">Logout</a>
|
|
116
|
+
</div>
|
|
117
|
+
<div class="col-md-6">
|
|
118
|
+
<pre class="prettyprint">
|
|
119
|
+
def logout
|
|
120
|
+
if(session[:oxd_access_token])
|
|
121
|
+
@logout_url = @oxd_command.get_logout_uri(session[:oxd_access_token], session[:state], session[:session_state])
|
|
122
|
+
redirect_to @logout_url
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
</pre>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Oxdrails</title>
|
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
|
7
|
+
<%= csrf_meta_tags %>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div class="container">
|
|
11
|
+
<%= yield %>
|
|
12
|
+
</div>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|