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

公開メンバ関数

def __init__ (self, currentTimeMillis)
 
def init (self, configurationAttributes)
 
def destroy (self, configurationAttributes)
 
def getApiVersion (self)
 
def gather (self, step, context)
 
def getNextStep (self, step, context)
 
def prepareForStep (self, step, context)
 
def getStepsCount (self, context)
 
def getPageForStep (self, step, context)
 

公開変数類

 currentTimeMillis
 

詳解

構築子と解体子

◆ __init__()

def UmaClaimsGathering.UmaClaimsGathering.__init__ (   self,
  currentTimeMillis 
)
11  def __init__(self, currentTimeMillis):
12  self.currentTimeMillis = currentTimeMillis
13 

関数詳解

◆ destroy()

def UmaClaimsGathering.UmaClaimsGathering.destroy (   self,
  configurationAttributes 
)
20  def destroy(self, configurationAttributes):
21  print "Claims-Gathering. Destroying ..."
22  print "Claims-Gathering. Destroyed successfully"
23  return True
24 

◆ gather()

def UmaClaimsGathering.UmaClaimsGathering.gather (   self,
  step,
  context 
)
32  def gather(self, step, context): # context is reference of org.xdi.oxauth.uma.authorization.UmaGatherContext
33  print "Claims-Gathering. Gathering ..."
34 
35  if step == 1:
36  if (context.getPageClaims().containsKey("country")):
37  country = context.getPageClaims().get("country")
38  print "Country: " + country
39 
40  context.putClaim("country", country)
41  return True
42 
43  print "Claims-Gathering. 'country' is not provided on step 1."
44  return False
45 
46  elif step == 2:
47  if (context.getPageClaims().containsKey("city")):
48  city = context.getPageClaims().get("city")
49  print "City: " + city
50 
51  context.putClaim("city", city)
52  print "Claims-Gathering. 'city' is not provided on step 2."
53  return True
54 
55  return False
56 

◆ getApiVersion()

def UmaClaimsGathering.UmaClaimsGathering.getApiVersion (   self)
25  def getApiVersion(self):
26  return 1
27 
28 

◆ getNextStep()

def UmaClaimsGathering.UmaClaimsGathering.getNextStep (   self,
  step,
  context 
)
57  def getNextStep(self, step, context):
58  return -1
59 

◆ getPageForStep()

def UmaClaimsGathering.UmaClaimsGathering.getPageForStep (   self,
  step,
  context 
)
87  def getPageForStep(self, step, context):
88  if step == 1:
89  return "/uma2/sample/country.xhtml"
90  elif step == 2:
91  return "/uma2/sample/city.xhtml"
92  return ""

◆ getStepsCount()

def UmaClaimsGathering.UmaClaimsGathering.getStepsCount (   self,
  context 
)
84  def getStepsCount(self, context):
85  return 2
86 

◆ init()

def UmaClaimsGathering.UmaClaimsGathering.init (   self,
  configurationAttributes 
)
14  def init(self, configurationAttributes):
15  print "Claims-Gathering. Initializing ..."
16  print "Claims-Gathering. Initialized successfully"
17 
18  return True
19 

◆ prepareForStep()

def UmaClaimsGathering.UmaClaimsGathering.prepareForStep (   self,
  step,
  context 
)
60  def prepareForStep(self, step, context):
61  if step == 10 and not context.isAuthenticated():
62  # user is not authenticated, so we are redirecting user to authorization endpoint
63  # client_id is specified via configuration attribute.
64  # Make sure that given client has redirect_uri to Claims-Gathering Endpoint with parameter authentication=true
65  # Sample https://sample.com/restv1/uma/gather_claims?authentication=true
66  # If redirect to external url is performated, make sure that viewAction has onPostback="true" (otherwise redirect will not work)
67  # After user is authenticated then within the script it's possible to get user attributes as
68  # context.getUser("uid", "sn")
69  # If user is authenticated to current AS (to the same server, not external one) then it's possible to
70  # access Connect session attributes directly (no need to obtain id_token after redirect with 'code').
71  # To fetch attributes please use getConnectSessionAttributes() method.
72 
73  print "User is not authenticated. Redirect for authentication ..."
74  clientId = context.getConfigurationAttributes().get("client_id").getValue2()
75  redirectUri = context.getClaimsGatheringEndpoint() + "?authentication=true" # without authentication=true parameter it will not work
76  authorizationUrl = context.getAuthorizationEndpoint() + "?client_id=" + clientId + "&redirect_uri=" + redirectUri + "&scope=openid&response_type=code"
77  context.redirectToExternalUrl(authorizationUrl) # redirect to external url
78  return False
79  if step == 10 and context.isAuthenticated(): # example how to get session attribute if user is authenticated to same AS
80  arc = context.getConnectSessionAttributes().get("acr")
81 
82  return True
83 

メンバ詳解

◆ currentTimeMillis

UmaClaimsGathering.UmaClaimsGathering.currentTimeMillis

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