| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 29 | 5 | public function handle(Request $request, Closure $next) |
|
| 30 | { |
||
| 31 | 5 | if (! $request->user()->halo_token) { |
|
| 32 | // Set intended route, so that after linking account, user is put where they were going |
||
| 33 | 4 | $this->redirector->setIntendedUrl($request->path()); |
|
| 34 | |||
| 35 | // Keys will be null if not enabled |
||
| 36 | 4 | $pkce = $this->halo->generateProofKey(); |
|
| 37 | |||
| 38 | 4 | $request->session()->flash('halo_code_verifier', $pkce['verifier'] ?? null); |
|
| 39 | |||
| 40 | 4 | return $this->redirector->to( |
|
| 41 | 4 | $this->halo->oauthUri( |
|
| 42 | 4 | challenge: $pkce['challenge'] ?? null, |
|
| 43 | 4 | uri: (string) $this->url_generator->route('halo.sso.redirect_uri'), |
|
| 44 | 4 | ) |
|
| 45 | 4 | ); |
|
| 46 | } |
||
| 47 | |||
| 48 | 1 | return $next($request); |
|
| 49 | } |
||
| 51 |