Skip to content

Commit

Permalink
B OpenNebula#2497: fix request sunstone_2f_auth (OpenNebula#3527)
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Lobo <jlobo@opennebula.systems>
  • Loading branch information
jloboescalona2 authored and Tino Vázquez committed Jul 18, 2019
1 parent 66f6b77 commit a7c7f00
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/sunstone/models/OpenNebula2FA/sunstone_2f_auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
require 'sunstone_optp'

# 2F Auth
module Suntone2FAuth
module Sunstone2FAuth

def self.authenticate(secret, token)
totp = SunstoneOPTP.build(secret, nil)
Expand Down
4 changes: 2 additions & 2 deletions src/sunstone/models/OpenNebulaJSON/UserJSON.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#--------------------------------------------------------------------------- #

require 'OpenNebulaJSON/JSONUtils'
require 'suntone_2f_auth'
require 'sunstone_2f_auth'

module OpenNebulaJSON
class UserJSON < OpenNebula::User
Expand Down Expand Up @@ -78,7 +78,7 @@ def update(params=Hash.new)
end

def enable_two_factor_auth(params=Hash.new)
unless Suntone2FAuth.authenticate(params["secret"], params["token"])
unless Sunstone2FAuth.authenticate(params["secret"], params["token"])
return OpenNebula::Error.new("Invalid token.")
end

Expand Down
4 changes: 2 additions & 2 deletions src/sunstone/sunstone-server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@

require "sunstone_qr_code"
require "sunstone_optp"
require "suntone_2f_auth"
require "sunstone_2f_auth"
require 'CloudAuth'
require 'SunstoneServer'
require 'SunstoneViews'
Expand Down Expand Up @@ -332,7 +332,7 @@ def build_session
if !two_factor_auth_token || two_factor_auth_token == ""
return [202, { code: "two_factor_auth" }.to_json]
else
unless Suntone2FAuth.authenticate(user[TWO_FACTOR_AUTH_SECRET_XPATH], two_factor_auth_token)
unless Sunstone2FAuth.authenticate(user[TWO_FACTOR_AUTH_SECRET_XPATH], two_factor_auth_token)
logger.info { "Unauthorized two factor authentication login attempt" }
return [401, ""]
end
Expand Down

0 comments on commit a7c7f00

Please sign in to comment.