• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NIT-Administrative-Systems / SysDev-laravel-soa / 7805057844

06 Feb 2024 07:28PM UTC coverage: 45.675% (-0.2%) from 45.913%
7805057844

push

github

web-flow
Housekeeping (#162)

11 of 35 new or added lines in 14 files covered. (31.43%)

9 existing lines in 7 files now uncovered.

264 of 578 relevant lines covered (45.67%)

14.07 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/src/Auth/Strategy/OpenAM11.php
1
<?php
2

3
namespace Northwestern\SysDev\SOA\Auth\Strategy;
4

5
use Illuminate\Http\Request;
6
use Northwestern\SysDev\SOA\Exceptions\InsecureSsoError;
7
use Northwestern\SysDev\SOA\WebSSO;
8

9
/**
10
 * OpenAM 11 ("new" webSSO) login strategy.
11
 */
12
class OpenAM11 implements WebSSOStrategy
13
{
14
    private $sso;
15

16
    public function __construct(WebSSO $sso_api)
17
    {
18
        $this->sso = $sso_api;
96✔
19
    }
20

21
    public function login(Request $request, string $login_route_name)
22
    {
23
        if (! $request->isSecure()) {
18✔
24
            throw new InsecureSsoError;
3✔
25
        }
26

27
        $login_url_w_redirect = $this->sso->getLoginUrl(route($login_route_name, [], false));
15✔
28

29
        // Laravel nulls out cookies that are not encrypted w/ its key.
30
        if (array_key_exists($this->sso->getCookieName(), $_COOKIE) === false) {
15✔
31
            throw new NoSsoSession($login_url_w_redirect);
3✔
32
        }
33

34
        $user = $this->sso->getUser($_COOKIE[$this->sso->getCookieName()]);
12✔
35
        if ($user === null) {
9✔
36
            throw new NoSsoSession($login_url_w_redirect);
3✔
37
        }
38

39
        // If we require MFA, make sure the user isn't just reusing an existing non-MFA'd login.
40
        if (config('duo.enabled') === true && $user->getMfaVerified() === false) {
6✔
41
            throw new NoSsoSession($login_url_w_redirect);
3✔
42
        }
43

44
        return $user->getNetid();
3✔
45
    }
46

47
    public function logout(?string $logout_return_to_route)
48
    {
49
        $redirect_to = null;
×
50
        if ($logout_return_to_route !== null) {
×
51
            $redirect_to = route($logout_return_to_route, [], false);
×
52
        }
53

UNCOV
54
        return redirect($this->sso->getLogoutUrl($redirect_to));
×
55
    }
56
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc