gluu
公開メンバ関数 | 公開変数類 | 全メンバ一覧
YubicloudExternalAuthenticator.PersonAuthentication クラス
YubicloudExternalAuthenticator.PersonAuthentication の継承関係図
Inheritance graph
YubicloudExternalAuthenticator.PersonAuthentication 連携図
Collaboration graph

公開メンバ関数

def __init__ (self, currentTimeMillis)
 
def init (self, configurationAttributes)
 
def destroy (self, configurationAttributes)
 
def getApiVersion (self)
 
def isValidAuthenticationMethod (self, usageType, configurationAttributes)
 
def getAlternativeAuthenticationMethod (self, usageType, configurationAttributes)
 
def authenticate (self, configurationAttributes, requestParameters, step)
 
def prepareForStep (self, configurationAttributes, requestParameters, step)
 
def getExtraParametersForStep (self, configurationAttributes, step)
 
def getCountAuthenticationSteps (self, configurationAttributes)
 
def getPageForStep (self, configurationAttributes, step)
 
def logout (self, configurationAttributes, requestParameters)
 

公開変数類

 currentTimeMillis
 
 api_server
 
 api_key
 
 client_id
 

詳解

構築子と解体子

◆ __init__()

def YubicloudExternalAuthenticator.PersonAuthentication.__init__ (   self,
  currentTimeMillis 
)
21  def __init__(self, currentTimeMillis):
22  self.currentTimeMillis = currentTimeMillis
23 

関数詳解

◆ authenticate()

def YubicloudExternalAuthenticator.PersonAuthentication.authenticate (   self,
  configurationAttributes,
  requestParameters,
  step 
)
46  def authenticate(self, configurationAttributes, requestParameters, step):
47  if (step == 1):
48  print "Yubicloud. Authenticate for step 1"
49 
50  identity = CdiUtil.bean(Identity)
51  credentials = identity.getCredentials()
52 
53  username = credentials.getUsername()
54  otp = credentials.getPassword()
55 
56  # Validate otp length
57  if len(otp) < 32 or len(otp) > 48:
58  print "Yubicloud. Invalid OTP length"
59  return False
60 
61  user_service = CdiUtil.bean(UserService)
62  user = user_service.getUser(username)
63 
64  public_key = user.getAttribute('yubikeyId')
65 
66  # Match the user with the yubikey
67  if public_key not in otp:
68  print "Yubicloud. Public Key not matching OTP"
69  return False
70 
71  data = ""
72  try:
73  nonce = str(uuid.uuid4()).replace("-", "")
74  params = urllib.urlencode({"id": self.client_id, "otp": otp, "nonce": nonce})
75  url = "https://" + self.api_server + "/wsapi/2.0/verify/?" + params
76  f = urllib2.urlopen(url)
77  data = f.read()
78  except Exception as e:
79  print "Yubicloud. Exception ", e
80 
81  if 'status=OK' in data:
82  user_service.authenticate(username)
83  print "Yubicloud. Authentication Successful"
84  return True
85 
86  print "Yubicloud. End of Step 1. Returning False."
87  return False
88  else:
89  return False
90 

◆ destroy()

def YubicloudExternalAuthenticator.PersonAuthentication.destroy (   self,
  configurationAttributes 
)
33  def destroy(self, configurationAttributes):
34  print "Yubicloud. Destroyed successfully"
35  return True
36 

◆ getAlternativeAuthenticationMethod()

def YubicloudExternalAuthenticator.PersonAuthentication.getAlternativeAuthenticationMethod (   self,
  usageType,
  configurationAttributes 
)
43  def getAlternativeAuthenticationMethod(self, usageType, configurationAttributes):
44  return None
45 

◆ getApiVersion()

def YubicloudExternalAuthenticator.PersonAuthentication.getApiVersion (   self)
37  def getApiVersion(self):
38  return 1
39 

◆ getCountAuthenticationSteps()

def YubicloudExternalAuthenticator.PersonAuthentication.getCountAuthenticationSteps (   self,
  configurationAttributes 
)
101  def getCountAuthenticationSteps(self, configurationAttributes):
102  return 1
103 

◆ getExtraParametersForStep()

def YubicloudExternalAuthenticator.PersonAuthentication.getExtraParametersForStep (   self,
  configurationAttributes,
  step 
)
98  def getExtraParametersForStep(self, configurationAttributes, step):
99  return None
100 

◆ getPageForStep()

def YubicloudExternalAuthenticator.PersonAuthentication.getPageForStep (   self,
  configurationAttributes,
  step 
)
104  def getPageForStep(self, configurationAttributes, step):
105  return ""
106 

◆ init()

def YubicloudExternalAuthenticator.PersonAuthentication.init (   self,
  configurationAttributes 
)
24  def init(self, configurationAttributes):
25  print "Yubicloud. Initialization"
26 
27  self.api_server = configurationAttributes.get("yubicloud_uri").getValue2()
28  self.api_key = configurationAttributes.get("yubicloud_api_key").getValue2()
29  self.client_id = configurationAttributes.get("yubicloud_id").getValue2()
30 
31  return True
32 

◆ isValidAuthenticationMethod()

def YubicloudExternalAuthenticator.PersonAuthentication.isValidAuthenticationMethod (   self,
  usageType,
  configurationAttributes 
)
40  def isValidAuthenticationMethod(self, usageType, configurationAttributes):
41  return True
42 

◆ logout()

def YubicloudExternalAuthenticator.PersonAuthentication.logout (   self,
  configurationAttributes,
  requestParameters 
)
107  def logout(self, configurationAttributes, requestParameters):
108  return True
109 

◆ prepareForStep()

def YubicloudExternalAuthenticator.PersonAuthentication.prepareForStep (   self,
  configurationAttributes,
  requestParameters,
  step 
)
91  def prepareForStep(self, configurationAttributes, requestParameters, step):
92  if (step == 1):
93  print "Yubicloud. Prepare for Step 1"
94  return True
95  else:
96  return False
97 

メンバ詳解

◆ api_key

YubicloudExternalAuthenticator.PersonAuthentication.api_key

◆ api_server

YubicloudExternalAuthenticator.PersonAuthentication.api_server

◆ client_id

YubicloudExternalAuthenticator.PersonAuthentication.client_id

◆ currentTimeMillis

YubicloudExternalAuthenticator.PersonAuthentication.currentTimeMillis

このクラス詳解は次のファイルから抽出されました: