1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-24 21:34:01 +03:00

bug #847: Fixes minor bugs in suntone-server

This commit is contained in:
Ruben S. Montero 2011-10-25 15:03:48 +02:00
parent 4f8a1c2f9d
commit 0e822f4035
3 changed files with 21 additions and 6 deletions

View File

@ -81,8 +81,7 @@ class CloudAuth
def expiration_time
time_now = Time.now.to_i
expire = time_now - @token_expiration_time
if expire < EXPIRE_MARGIN
if time_now > @token_expiration_time - EXPIRE_MARGIN
@token_expiration_time = time_now + @token_expiration_delta
end

View File

@ -5,8 +5,14 @@
:host: 127.0.0.1
:port: 9869
:auth: basic
# Authentication driver for incomming requests
:auth: sunstone
# Authentication driver to communicate with OpenNebula core
:core_auth: cipher
# Life-time in seconds for token renewal (that used to handle OpenNebula auths)
:token_expiration_delta: 1800
# VNC Configuration
:vnc_proxy_base_port: 29876
:novnc_path:

View File

@ -88,7 +88,7 @@ helpers do
else
client = settings.cloud_auth.client(result)
user_id = OpenNebula::User::SELF
user = OpenNebula::User.new_with_id(user_id, client)
rc = user.info
if OpenNebula.is_error?(rc)
@ -143,7 +143,12 @@ end
##############################################################################
get '/' do
if !authorized?
templ = settings.config[:auth]=="basic"? "login.html" : "login_x509.html"
if settings.config[:auth] == "x509"
templ = "login_x509.html"
else
templ = "login.html"
end
return File.read(File.dirname(__FILE__)+'/templates/'+templ)
end
time = Time.now + 60
@ -165,7 +170,12 @@ end
get '/login' do
if !authorized?
templ = settings.config[:auth]=="basic"? "login.html" : "login_x509.html"
if settings.config[:auth] == "x509"
templ = "login_x509.html"
else
templ = "login.html"
end
return File.read(File.dirname(__FILE__)+'/templates/'+templ)
end
end