gluu
公開メンバ関数 | 公開変数類 | 全メンバ一覧
register.PersonAuthentication クラス
register.PersonAuthentication の継承関係図
Inheritance graph
register.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 getUserValueFromAuth (self, remote_attr, requestParameters)
 
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)
 
def prepareAttributesMapping (self, remoteAttributesList, localAttributesList)
 

公開変数類

 currentTimeMillis
 
 attributesMapping
 

詳解

構築子と解体子

◆ __init__()

def register.PersonAuthentication.__init__ (   self,
  currentTimeMillis 
)
27  def __init__(self, currentTimeMillis):
28  self.currentTimeMillis = currentTimeMillis
29 

関数詳解

◆ authenticate()

def register.PersonAuthentication.authenticate (   self,
  configurationAttributes,
  requestParameters,
  step 
)
74  def authenticate(self, configurationAttributes, requestParameters, step):
75  print "Registration. Authenticate for step 1"
76  userService = CdiUtil.bean(UserService)
77  authenticationService = CdiUtil.bean(AuthenticationService)
78 
79  if (StringHelper.isEmptyString(self.getUserValueFromAuth("email", requestParameters))):
80  facesMessages = CdiUtil.bean(FacesMessages)
81  facesMessages.setKeepMessages()
82  facesMessages.add(FacesMessage.SEVERITY_ERROR, "Please provide your email.")
83  return False
84 
85  if (StringHelper.isEmptyString(self.getUserValueFromAuth("pwd", requestParameters))):
86  facesMessages = CdiUtil.bean(FacesMessages)
87  facesMessages.setKeepMessages()
88  facesMessages.add(FacesMessage.SEVERITY_ERROR, "Please provide password.")
89  return False
90 
91 
92 
93  foundUser = userService.getUserByAttribute("mail", self.getUserValueFromAuth("email", requestParameters))
94  if (foundUser == None):
95  newUser = User()
96  for attributesMappingEntry in self.attributesMapping.entrySet():
97  remoteAttribute = attributesMappingEntry.getKey()
98  localAttribute = attributesMappingEntry.getValue()
99  localAttributeValue = self.getUserValueFromAuth(remoteAttribute, requestParameters)
100  if ((localAttribute != None) & (localAttributeValue != "undefined")):
101  print localAttribute + localAttributeValue
102  newUser.setAttribute(localAttribute, localAttributeValue)
103 
104  try:
105  foundUser = userService.addUser(newUser, True)
106  foundUserName = foundUser.getUserId()
107  print("Registration: Found user name " + foundUserName)
108  userAuthenticated = authenticationService.authenticate(foundUserName)
109  print("Registration: User added successfully and isUserAuthenticated = " + str(userAuthenticated))
110  except Exception, err:
111  print("Registration: Error in adding user:" + str(err))
112  return False
113  return userAuthenticated
114  else:
115  facesMessages = CdiUtil.bean(FacesMessages)
116  facesMessages.setKeepMessages()
117  facesMessages.add(FacesMessage.SEVERITY_ERROR, "User with same email already exists!")
118  return False
119 
120 
121 

◆ destroy()

def register.PersonAuthentication.destroy (   self,
  configurationAttributes 
)
54  def destroy(self, configurationAttributes):
55  print "Registration. Destroy"
56  print "Registration. Destroyed successfully"
57  return True
58 

◆ getAlternativeAuthenticationMethod()

def register.PersonAuthentication.getAlternativeAuthenticationMethod (   self,
  usageType,
  configurationAttributes 
)
65  def getAlternativeAuthenticationMethod(self, usageType, configurationAttributes):
66  return None

◆ getApiVersion()

def register.PersonAuthentication.getApiVersion (   self)
59  def getApiVersion(self):
60  return 1
61 

◆ getCountAuthenticationSteps()

def register.PersonAuthentication.getCountAuthenticationSteps (   self,
  configurationAttributes 
)
132  def getCountAuthenticationSteps(self, configurationAttributes):
133  return 1
134 

◆ getExtraParametersForStep()

def register.PersonAuthentication.getExtraParametersForStep (   self,
  configurationAttributes,
  step 
)
129  def getExtraParametersForStep(self, configurationAttributes, step):
130  return None
131 

◆ getPageForStep()

def register.PersonAuthentication.getPageForStep (   self,
  configurationAttributes,
  step 
)
135  def getPageForStep(self, configurationAttributes, step):
136  if step == 1:
137  return "/auth/register/register.xhtml"
138 

◆ getUserValueFromAuth()

def register.PersonAuthentication.getUserValueFromAuth (   self,
  remote_attr,
  requestParameters 
)
67  def getUserValueFromAuth(self, remote_attr, requestParameters):
68  try:
69  toBeFeatched = "loginForm:" + remote_attr
70  return ServerUtil.getFirstValue(requestParameters, toBeFeatched)
71  except Exception, err:
72  print("Registration: Exception inside getUserValueFromAuth " + str(err))
73 

◆ init()

def register.PersonAuthentication.init (   self,
  configurationAttributes 
)
30  def init(self, configurationAttributes):
31  print "Registration. Initialization"
32  print "Registration. Initialized successfully"
33  if (configurationAttributes.containsKey("generic_register_attributes_list") and
34  configurationAttributes.containsKey("generic_local_attributes_list")):
35 
36  remoteAttributesList = configurationAttributes.get("generic_register_attributes_list").getValue2()
37  if (StringHelper.isEmpty(remoteAttributesList)):
38  print "Registration: Initialization. The property generic_register_attributes_list is empty"
39  return False
40 
41  localAttributesList = configurationAttributes.get("generic_local_attributes_list").getValue2()
42  if (StringHelper.isEmpty(localAttributesList)):
43  print "Registration: Initialization. The property generic_local_attributes_list is empty"
44  return False
45 
46  self.attributesMapping = self.prepareAttributesMapping(remoteAttributesList, localAttributesList)
47  if (self.attributesMapping == None):
48  print "Registration: Initialization. The attributes mapping isn't valid"
49  return False
50 
51  return True
52 
53 

◆ isValidAuthenticationMethod()

def register.PersonAuthentication.isValidAuthenticationMethod (   self,
  usageType,
  configurationAttributes 
)
62  def isValidAuthenticationMethod(self, usageType, configurationAttributes):
63  return True
64 

◆ logout()

def register.PersonAuthentication.logout (   self,
  configurationAttributes,
  requestParameters 
)
139  def logout(self, configurationAttributes, requestParameters):
140  return True
141 

◆ prepareAttributesMapping()

def register.PersonAuthentication.prepareAttributesMapping (   self,
  remoteAttributesList,
  localAttributesList 
)
142  def prepareAttributesMapping(self, remoteAttributesList, localAttributesList):
143  try:
144  remoteAttributesListArray = StringHelper.split(remoteAttributesList, ",")
145  if (ArrayHelper.isEmpty(remoteAttributesListArray)):
146  print("Registration: PrepareAttributesMapping. There is no attributes specified in remoteAttributesList property")
147  return None
148 
149  localAttributesListArray = StringHelper.split(localAttributesList, ",")
150  if (ArrayHelper.isEmpty(localAttributesListArray)):
151  print("Registration: PrepareAttributesMapping. There is no attributes specified in localAttributesList property")
152  return None
153 
154  if (len(remoteAttributesListArray) != len(localAttributesListArray)):
155  print("Registration: PrepareAttributesMapping. The number of attributes in remoteAttributesList and localAttributesList isn't equal")
156  return None
157 
158  attributeMapping = IdentityHashMap()
159  containsUid = False
160  i = 0
161  count = len(remoteAttributesListArray)
162  while (i < count):
163  remoteAttribute = StringHelper.toLowerCase(remoteAttributesListArray[i])
164  localAttribute = StringHelper.toLowerCase(localAttributesListArray[i])
165  attributeMapping.put(remoteAttribute, localAttribute)
166 
167  i = i + 1
168 
169  return attributeMapping
170  except Exception, err:
171  print("Registration: Exception inside prepareAttributesMapping " + str(err))
172 

◆ prepareForStep()

def register.PersonAuthentication.prepareForStep (   self,
  configurationAttributes,
  requestParameters,
  step 
)
122  def prepareForStep(self, configurationAttributes, requestParameters, step):
123  if (step == 1):
124  print "Registration. Prepare for Step 1"
125  return True
126  else:
127  return False
128 

メンバ詳解

◆ attributesMapping

register.PersonAuthentication.attributesMapping

◆ currentTimeMillis

register.PersonAuthentication.currentTimeMillis

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