gluu
公開メンバ関数 | 非公開変数類 | 全メンバ一覧
org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService クラス
org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService 連携図
Collaboration graph

公開メンバ関数

SessionId getConnectSession (HttpServletRequest httpRequest)
 
SessionId getSession (HttpServletRequest httpRequest, HttpServletResponse httpResponse, String userDn, boolean create)
 
void setAuthenticatedSessionState (HttpServletRequest httpRequest, SessionId sessionId)
 
boolean isSessionStateAuthenticated (HttpServletRequest httpRequest)
 
boolean persist (SessionId session)
 
int getStep (SessionId session)
 
void setStep (int step, SessionId session)
 
void configure (SessionId session, String scriptName, String clientId, String state)
 
boolean isStepPassed (SessionId session, Integer step)
 
boolean isPassedPreviousSteps (SessionId session, Integer step)
 
void markStep (SessionId session, Integer step, boolean value)
 
String getScriptName (SessionId session)
 
void setScriptName (SessionId session, String scriptName)
 
String getClientId (SessionId session)
 
void setClientId (SessionId session, String clientId)
 
void resetToStep (SessionId session, int overridenNextStep, int step)
 
User getUser (HttpServletRequest httpRequest, String... returnAttributes)
 
String getUserDn (HttpServletRequest httpRequest)
 
Client getClient (SessionId session)
 

非公開変数類

Logger log
 
SessionIdService sessionIdService
 
UserService userService
 
ClientService clientService
 

詳解

著者
Yuriy Movchan Date: 10/30/2017

関数詳解

◆ configure()

void org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.configure ( SessionId  session,
String  scriptName,
String  clientId,
String  state 
)
inline
121  {
122  setStep(1, session);
123  setScriptName(session, scriptName);
124 
125  setClientId(session, clientId);
126  persist(session);
127  }
boolean persist(SessionId session)
Definition: ConsentGatheringSessionService.java:94
void setStep(int step, SessionId session)
Definition: ConsentGatheringSessionService.java:117
void setClientId(SessionId session, String clientId)
Definition: ConsentGatheringSessionService.java:163
void setScriptName(SessionId session, String scriptName)
Definition: ConsentGatheringSessionService.java:155

◆ getClient()

Client org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.getClient ( SessionId  session)
inline
194  {
195  String clientId = getClientId(session);
196  if (StringUtils.isNotBlank(clientId)) {
197  return clientService.getClient(clientId);
198  }
199  log.trace("client_id is not in session.");
200  return null;
201  }
ClientService clientService
Definition: ConsentGatheringSessionService.java:42
String getClientId(SessionId session)
Definition: ConsentGatheringSessionService.java:159
Logger log
Definition: ConsentGatheringSessionService.java:33
Set< Client > getClient(Collection< String > clientIds, boolean silent)
Definition: ClientService.java:123

◆ getClientId()

String org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.getClientId ( SessionId  session)
inline
159  {
160  return session.getSessionAttributes().get("client_id");
161  }

◆ getConnectSession()

SessionId org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.getConnectSession ( HttpServletRequest  httpRequest)
inline
44  {
45  String cookieId = sessionIdService.getSessionIdFromCookie(httpRequest);
46  log.trace("Cookie - session_id: ", cookieId);
47  if (StringUtils.isNotBlank(cookieId)) {
48  return sessionIdService.getSessionId(cookieId);
49  }
50 
51  return null;
52  }
SessionId getSessionId()
Definition: SessionIdService.java:360
SessionIdService sessionIdService
Definition: ConsentGatheringSessionService.java:36
Logger log
Definition: ConsentGatheringSessionService.java:33
String getSessionIdFromCookie(HttpServletRequest request)
Definition: SessionIdService.java:237

◆ getScriptName()

String org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.getScriptName ( SessionId  session)
inline
151  {
152  return session.getSessionAttributes().get("gather_script_name");
153  }

◆ getSession()

SessionId org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.getSession ( HttpServletRequest  httpRequest,
HttpServletResponse  httpResponse,
String  userDn,
boolean  create 
)
inline
54  {
55  String cookieId = sessionIdService.getConsentSessionIdFromCookie(httpRequest);
56  log.trace("Cookie - consent_session_id: ", cookieId);
57 
58  if (StringUtils.isNotBlank(cookieId)) {
59  SessionId sessionId = sessionIdService.getSessionId(cookieId);
60  if (sessionId != null) {
61  log.trace("Loaded consent_session_id from cookie, session: ", sessionId);
62  return sessionId;
63  } else {
64  log.error("Failed to load consent_session_id from cookie: ", cookieId);
65  }
66  } else {
67  log.error("consent_session_id cookie is not set.");
68  }
69 
70  if (!create) {
71  return null;
72  }
73 
74  log.trace("Generating new consent_session_id ...");
75  SessionId session = sessionIdService.generateUnauthenticatedSessionId(userDn);
76 
77  sessionIdService.createSessionIdCookie(session.getId(), session.getSessionState(), httpResponse, SessionIdService.CONSENT_SESSION_ID_COOKIE_NAME);
78  log.trace("consent_session_id cookie created.");
79 
80  return session;
81  }
SessionId getSessionId()
Definition: SessionIdService.java:360
String getConsentSessionIdFromCookie(HttpServletRequest request)
Definition: SessionIdService.java:245
SessionIdService sessionIdService
Definition: ConsentGatheringSessionService.java:36
Logger log
Definition: ConsentGatheringSessionService.java:33
void createSessionIdCookie(String sessionId, String sessionState, HttpServletResponse httpResponse, String cookieName)
Definition: SessionIdService.java:284
SessionId generateUnauthenticatedSessionId(String userDn)
Definition: SessionIdService.java:405

◆ getStep()

int org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.getStep ( SessionId  session)
inline
107  {
108  String stepString = session.getSessionAttributes().get("step");
109  int step = Util.parseIntSilently(stepString);
110  if (step == -1) {
111  step = 1;
112  setStep(step, session);
113  }
114  return step;
115  }
void setStep(int step, SessionId session)
Definition: ConsentGatheringSessionService.java:117

◆ getUser()

User org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.getUser ( HttpServletRequest  httpRequest,
String...  returnAttributes 
)
inline
175  {
176  String userDn = getUserDn(httpRequest);
177  if (StringUtils.isNotBlank(userDn)) {
178  return userService.getUserByDn(userDn, returnAttributes);
179  }
180 
181  return null;
182  }
String getUserDn(HttpServletRequest httpRequest)
Definition: ConsentGatheringSessionService.java:184
UserService userService
Definition: ConsentGatheringSessionService.java:39
User getUserByDn(String dn, String... returnAttributes)
Definition: UserService.java:66

◆ getUserDn()

String org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.getUserDn ( HttpServletRequest  httpRequest)
inline
184  {
185  SessionId connectSession = getConnectSession(httpRequest);
186  if (connectSession != null) {
187  return connectSession.getUserDn();
188  }
189 
190  log.trace("No logged in user.");
191  return null;
192  }
SessionId getConnectSession(HttpServletRequest httpRequest)
Definition: ConsentGatheringSessionService.java:44
Logger log
Definition: ConsentGatheringSessionService.java:33

◆ isPassedPreviousSteps()

boolean org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.isPassedPreviousSteps ( SessionId  session,
Integer  step 
)
inline
133  {
134  for (int i = 1; i < step; i++) {
135  if (!isStepPassed(session, i)) {
136  return false;
137  }
138  }
139  return true;
140  }
boolean isStepPassed(SessionId session, Integer step)
Definition: ConsentGatheringSessionService.java:129

◆ isSessionStateAuthenticated()

boolean org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.isSessionStateAuthenticated ( HttpServletRequest  httpRequest)
inline
88  {
89  final SessionId session = getSession(httpRequest, null, null, false);
90 
92  }
SessionIdService sessionIdService
Definition: ConsentGatheringSessionService.java:36
boolean isSessionIdAuthenticated()
Definition: SessionIdService.java:729
SessionId getSession(HttpServletRequest httpRequest, HttpServletResponse httpResponse, String userDn, boolean create)
Definition: ConsentGatheringSessionService.java:54

◆ isStepPassed()

boolean org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.isStepPassed ( SessionId  session,
Integer  step 
)
inline
129  {
130  return Boolean.parseBoolean(session.getSessionAttributes().get(String.format("consent_step_passed_%d", step)));
131  }

◆ markStep()

void org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.markStep ( SessionId  session,
Integer  step,
boolean  value 
)
inline
142  {
143  String key = String.format("consent_step_passed_%d", step);
144  if (value) {
145  session.getSessionAttributes().put(key, Boolean.TRUE.toString());
146  } else {
147  session.getSessionAttributes().remove(key);
148  }
149  }

◆ persist()

boolean org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.persist ( SessionId  session)
inline
94  {
95  try {
96  if (sessionIdService.persistSessionId(session, true)) {
97  log.trace("Session persisted successfully. Session: " + session);
98  return true;
99  }
100  } catch (Exception e) {
101  log.error("Failed to persist session, id: " + session.getId(), e);
102  }
103 
104  return false;
105  }
boolean persistSessionId(final SessionId sessionId)
Definition: SessionIdService.java:510
SessionIdService sessionIdService
Definition: ConsentGatheringSessionService.java:36
Logger log
Definition: ConsentGatheringSessionService.java:33

◆ resetToStep()

void org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.resetToStep ( SessionId  session,
int  overridenNextStep,
int  step 
)
inline
167  {
168  for (int i = overridenNextStep; i <= step; i++) {
169  markStep(session, i, false);
170  }
171 
172  setStep(overridenNextStep, session);
173  }
void setStep(int step, SessionId session)
Definition: ConsentGatheringSessionService.java:117
void markStep(SessionId session, Integer step, boolean value)
Definition: ConsentGatheringSessionService.java:142

◆ setAuthenticatedSessionState()

void org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.setAuthenticatedSessionState ( HttpServletRequest  httpRequest,
SessionId  sessionId 
)
inline
83  {
84  SessionId connectSession = getConnectSession(httpRequest);
85  sessionIdService.setSessionIdStateAuthenticated(httpRequest, sessionId, connectSession.getDn());
86  }
SessionId setSessionIdStateAuthenticated(HttpServletRequest httpRequest, SessionId sessionId, String p_userDn)
Definition: SessionIdService.java:491
SessionIdService sessionIdService
Definition: ConsentGatheringSessionService.java:36
SessionId getConnectSession(HttpServletRequest httpRequest)
Definition: ConsentGatheringSessionService.java:44

◆ setClientId()

void org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.setClientId ( SessionId  session,
String  clientId 
)
inline
163  {
164  session.getSessionAttributes().put("client_id", clientId);
165  }

◆ setScriptName()

void org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.setScriptName ( SessionId  session,
String  scriptName 
)
inline
155  {
156  session.getSessionAttributes().put("gather_script_name", scriptName);
157  }

◆ setStep()

void org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.setStep ( int  step,
SessionId  session 
)
inline
117  {
118  session.getSessionAttributes().put("step", Integer.toString(step));
119  }

メンバ詳解

◆ clientService

ClientService org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.clientService
private

◆ log

Logger org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.log
private

◆ sessionIdService

SessionIdService org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.sessionIdService
private

◆ userService

UserService org.xdi.oxauth.authorize.ws.rs.ConsentGatheringSessionService.userService
private

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