MCPcopy Index your code
hub / github.com/apache/tomcat / invoke

Method invoke

java/org/apache/catalina/authenticator/SingleSignOn.java:236–325  ·  view source on GitHub ↗

Perform single-sign-on support processing for this request. @param request The servlet request we are processing @param response The servlet response we are creating @exception IOException if an input/output error occurs @exception ServletException if a servlet error occurs

(Request request, Response response)

Source from the content-addressed store, hash-verified

234 * @exception ServletException if a servlet error occurs
235 */
236 @Override
237 public void invoke(Request request, Response response) throws IOException, ServletException {
238
239 request.removeNote(Constants.REQ_SSOID_NOTE);
240
241 // Has a valid user already been authenticated?
242 if (containerLog.isTraceEnabled()) {
243 containerLog.trace(sm.getString("singleSignOn.debug.invoke", request.getRequestURI()));
244 }
245 if (request.getUserPrincipal() != null) {
246 if (containerLog.isDebugEnabled()) {
247 containerLog
248 .debug(sm.getString("singleSignOn.debug.hasPrincipal", request.getUserPrincipal().getName()));
249 }
250 getNext().invoke(request, response);
251 return;
252 }
253
254 // Check for the single sign on cookie
255 if (containerLog.isTraceEnabled()) {
256 containerLog.trace(sm.getString("singleSignOn.debug.cookieCheck"));
257 }
258 Cookie cookie = null;
259 Cookie[] cookies = request.getCookies();
260 if (cookies != null) {
261 for (Cookie value : cookies) {
262 if (cookieName.equals(value.getName())) {
263 cookie = value;
264 break;
265 }
266 }
267 }
268 if (cookie == null) {
269 if (containerLog.isDebugEnabled()) {
270 containerLog.debug(sm.getString("singleSignOn.debug.cookieNotFound"));
271 }
272 getNext().invoke(request, response);
273 return;
274 }
275
276 // Look up the cached Principal associated with this cookie value
277 if (containerLog.isTraceEnabled()) {
278 containerLog.trace(sm.getString("singleSignOn.debug.principalCheck", cookie.getValue()));
279 }
280 SingleSignOnEntry entry = cache.get(cookie.getValue());
281 if (entry != null) {
282 if (containerLog.isDebugEnabled()) {
283 containerLog.debug(sm.getString("singleSignOn.debug.principalFound",
284 entry.getPrincipal() != null ? entry.getPrincipal().getName() : "", entry.getAuthType()));
285 }
286 request.setNote(Constants.REQ_SSOID_NOTE, cookie.getValue());
287 // Only set security elements if reauthentication is not required
288 if (!getRequireReauthentication()) {
289 request.setAuthType(entry.getAuthType());
290 request.setUserPrincipal(entry.getPrincipal());
291 }
292 } else {
293 if (containerLog.isDebugEnabled()) {

Callers

nothing calls this directly

Calls 15

getValueMethod · 0.95
getPrincipalMethod · 0.95
getAuthTypeMethod · 0.95
setValueMethod · 0.95
setMaxAgeMethod · 0.95
setPathMethod · 0.95
getCookieDomainMethod · 0.95
setDomainMethod · 0.95
setSecureMethod · 0.95
setHttpOnlyMethod · 0.95
setAttributeMethod · 0.95

Tested by

no test coverage detected