LCOV - code coverage report
Current view: top level - httpd/auth/openid - OAuthOverOpenIDLogoutServlet.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 6 7 85.7 %
Date: 2022-11-19 15:00:39 Functions: 2 2 100.0 %

          Line data    Source code
       1             : // Copyright (C) 2015 The Android Open Source Project
       2             : //
       3             : // Licensed under the Apache License, Version 2.0 (the "License");
       4             : // you may not use this file except in compliance with the License.
       5             : // You may obtain a copy of the License at
       6             : //
       7             : // http://www.apache.org/licenses/LICENSE-2.0
       8             : //
       9             : // Unless required by applicable law or agreed to in writing, software
      10             : // distributed under the License is distributed on an "AS IS" BASIS,
      11             : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12             : // See the License for the specific language governing permissions and
      13             : // limitations under the License.
      14             : 
      15             : package com.google.gerrit.httpd.auth.openid;
      16             : 
      17             : import com.google.gerrit.common.Nullable;
      18             : import com.google.gerrit.extensions.registration.DynamicItem;
      19             : import com.google.gerrit.httpd.HttpLogoutServlet;
      20             : import com.google.gerrit.httpd.WebSession;
      21             : import com.google.gerrit.server.config.AuthConfig;
      22             : import com.google.gerrit.server.config.CanonicalWebUrl;
      23             : import com.google.gerrit.server.group.GroupAuditService;
      24             : import com.google.inject.Inject;
      25             : import com.google.inject.Provider;
      26             : import com.google.inject.Singleton;
      27             : import java.io.IOException;
      28             : import javax.servlet.http.HttpServletRequest;
      29             : import javax.servlet.http.HttpServletResponse;
      30             : 
      31             : @Singleton
      32             : class OAuthOverOpenIDLogoutServlet extends HttpLogoutServlet {
      33             :   private static final long serialVersionUID = 1L;
      34             : 
      35             :   private final Provider<OAuthSessionOverOpenID> oauthSession;
      36             : 
      37             :   @Inject
      38             :   OAuthOverOpenIDLogoutServlet(
      39             :       AuthConfig authConfig,
      40             :       DynamicItem<WebSession> webSession,
      41             :       @CanonicalWebUrl @Nullable Provider<String> urlProvider,
      42             :       GroupAuditService audit,
      43             :       Provider<OAuthSessionOverOpenID> oauthSession) {
      44          99 :     super(authConfig, webSession, urlProvider, audit);
      45          99 :     this.oauthSession = oauthSession;
      46          99 :   }
      47             : 
      48             :   @Override
      49             :   protected void doLogout(HttpServletRequest req, HttpServletResponse rsp) throws IOException {
      50           1 :     super.doLogout(req, rsp);
      51           1 :     if (req.getSession(false) != null) {
      52           0 :       oauthSession.get().logout();
      53             :     }
      54           1 :   }
      55             : }

Generated by: LCOV version 1.16+git.20220603.dfeb750