| Total Complexity | 15 |
| Total Lines | 128 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class WebAuthController extends AuthController |
||
| 9 | { |
||
| 10 | // Route to save unauthenticated users original page request and redirect to oauth provider redirect |
||
| 11 | public function loginOrRegister(\Illuminate\Http\Request $request) |
||
| 23 | } |
||
| 24 | |||
| 25 | // Route to clear the session and redirect to oauth signout handler |
||
| 26 | public function logout(\Illuminate\Http\Request $request) |
||
|
1 ignored issue
–
show
|
|||
| 27 | { |
||
| 28 | auth()->logout(); |
||
| 29 | return redirect(config('enterpriseauth.routes.logout')); |
||
| 30 | } |
||
| 31 | |||
| 32 | // Route to redirect to oauth idp end-session endpoint |
||
| 33 | public function logoutFromOauthProvider(\Illuminate\Http\Request $request) |
||
| 37 | } |
||
| 38 | |||
| 39 | // Route called to redirect administrative users to provide consent to access aad |
||
| 40 | public function redirectToOauthAdminConsent(\Illuminate\Http\Request $request) |
||
|
1 ignored issue
–
show
|
|||
| 41 | { |
||
| 42 | $url = $this->azureActiveDirectory->buildAdminConsentUrl(config('enterpriseauth.credentials.client_id'), |
||
| 43 | config('enterpriseauth.credentials.callback_url')); |
||
| 44 | //return new \Illuminate\Http\RedirectResponse($url); |
||
| 45 | return redirect($url); |
||
| 46 | } |
||
| 47 | |||
| 48 | // Route called to redirect unauthenticated users to oauth identity provider |
||
| 49 | public function redirectToOauthProvider(\Illuminate\Http\Request $request) |
||
|
1 ignored issue
–
show
|
|||
| 50 | { |
||
| 51 | $url = $this->buildAuthUrl(); |
||
| 52 | //return new \Illuminate\Http\RedirectResponse($url); |
||
| 53 | return redirect($url); |
||
| 54 | } |
||
| 55 | |||
| 56 | // Helper to build redirect url from azure AD tenant |
||
| 57 | public function buildAuthUrl() |
||
| 64 | } |
||
| 65 | |||
| 66 | // helper to build query string for oauth provider |
||
| 67 | public function buildAuthUrlQueryString() |
||
| 68 | { |
||
| 69 | $fields = [ |
||
| 70 | 'client_id' => config('enterpriseauth.credentials.client_id'), |
||
| 71 | 'redirect_uri' => config('enterpriseauth.credentials.callback_url'), |
||
| 72 | 'scope' => 'https://graph.microsoft.com/.default', |
||
| 73 | 'response_type' => 'code', |
||
| 74 | ]; |
||
| 75 | |||
| 76 | return http_build_query($fields); |
||
| 77 | } |
||
| 78 | |||
| 79 | // Route to handle response back from our oauth provider |
||
| 80 | public function handleOauthResponse(\Illuminate\Http\Request $request) |
||
| 90 | } |
||
| 91 | |||
| 92 | public function handleOauthLoginResponse(\Illuminate\Http\Request $request) |
||
| 111 | } |
||
| 112 | |||
| 113 | // Turn coke into pepsi: Take the authorization code and turn it into an access token for graph api |
||
| 114 | public function getAccessTokenFromCode($code) |
||
| 138 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.