mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-03-02 02:08:38 +08:00
Applied latest StyleCI changes
This commit is contained in:
parent
1e112f78d8
commit
83082c32ef
app
Auth/Access/Oidc
Http/Controllers/Auth
@ -4,4 +4,6 @@ namespace BookStack\Auth\Access\Oidc;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class OidcException extends Exception {}
|
class OidcException extends Exception
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -4,4 +4,6 @@ namespace BookStack\Auth\Access\Oidc;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class OidcIssuerDiscoveryException extends Exception {}
|
class OidcIssuerDiscoveryException extends Exception
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -2,18 +2,18 @@
|
|||||||
|
|
||||||
namespace BookStack\Auth\Access\Oidc;
|
namespace BookStack\Auth\Access\Oidc;
|
||||||
|
|
||||||
|
use function auth;
|
||||||
use BookStack\Auth\Access\LoginService;
|
use BookStack\Auth\Access\LoginService;
|
||||||
use BookStack\Auth\Access\RegistrationService;
|
use BookStack\Auth\Access\RegistrationService;
|
||||||
use BookStack\Auth\User;
|
use BookStack\Auth\User;
|
||||||
use BookStack\Exceptions\JsonDebugException;
|
use BookStack\Exceptions\JsonDebugException;
|
||||||
use BookStack\Exceptions\StoppedAuthenticationException;
|
use BookStack\Exceptions\StoppedAuthenticationException;
|
||||||
use BookStack\Exceptions\UserRegistrationException;
|
use BookStack\Exceptions\UserRegistrationException;
|
||||||
|
use function config;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use League\OAuth2\Client\OptionProvider\HttpBasicAuthOptionProvider;
|
use League\OAuth2\Client\OptionProvider\HttpBasicAuthOptionProvider;
|
||||||
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
|
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
|
||||||
use Psr\Http\Client\ClientInterface as HttpClient;
|
use Psr\Http\Client\ClientInterface as HttpClient;
|
||||||
use function auth;
|
|
||||||
use function config;
|
|
||||||
use function trans;
|
use function trans;
|
||||||
use function url;
|
use function url;
|
||||||
|
|
||||||
@ -40,8 +40,9 @@ class OidcService
|
|||||||
/**
|
/**
|
||||||
* Initiate an authorization flow.
|
* Initiate an authorization flow.
|
||||||
*
|
*
|
||||||
* @return array{url: string, state: string}
|
|
||||||
* @throws OidcException
|
* @throws OidcException
|
||||||
|
*
|
||||||
|
* @return array{url: string, state: string}
|
||||||
*/
|
*/
|
||||||
public function login(): array
|
public function login(): array
|
||||||
{
|
{
|
||||||
@ -77,7 +78,6 @@ class OidcService
|
|||||||
return $this->processAccessTokenCallback($accessToken, $settings);
|
return $this->processAccessTokenCallback($accessToken, $settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws OidcException
|
* @throws OidcException
|
||||||
*/
|
*/
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace BookStack\Http\Controllers\Auth;
|
namespace BookStack\Http\Controllers\Auth;
|
||||||
|
|
||||||
use BookStack\Auth\Access\Oidc\OidcService;
|
|
||||||
use BookStack\Auth\Access\Oidc\OidcException;
|
use BookStack\Auth\Access\Oidc\OidcException;
|
||||||
|
use BookStack\Auth\Access\Oidc\OidcService;
|
||||||
use BookStack\Http\Controllers\Controller;
|
use BookStack\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@ -29,6 +29,7 @@ class OidcController extends Controller
|
|||||||
$loginDetails = $this->oidcService->login();
|
$loginDetails = $this->oidcService->login();
|
||||||
} catch (OidcException $exception) {
|
} catch (OidcException $exception) {
|
||||||
$this->showErrorNotification($exception->getMessage());
|
$this->showErrorNotification($exception->getMessage());
|
||||||
|
|
||||||
return redirect('/login');
|
return redirect('/login');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ class OidcController extends Controller
|
|||||||
$this->oidcService->processAuthorizeResponse($request->query('code'));
|
$this->oidcService->processAuthorizeResponse($request->query('code'));
|
||||||
} catch (OidcException $oidcException) {
|
} catch (OidcException $oidcException) {
|
||||||
$this->showErrorNotification($oidcException->getMessage());
|
$this->showErrorNotification($oidcException->getMessage());
|
||||||
|
|
||||||
return redirect('/login');
|
return redirect('/login');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user