Skip to content

Commit

Permalink
Added support to specify keycloak version
Browse files Browse the repository at this point in the history
  • Loading branch information
micbis authored and weaverryan committed Dec 20, 2022
1 parent 4029970 commit b701e75
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,8 @@ knpu_oauth2_client:
# encryption_key_path: null
# Optional: Encryption key, i.e. contents of key or certificate
# encryption_key: null
# Optional: The keycloak version to run against
# version: '20.0.1'
# whether to check OAuth2 "state": defaults to true
# use_state: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public function buildConfiguration(NodeBuilder $node)
->defaultNull()
->info('Optional: Encryption key, i.e. contents of key or certificate')
->end()
->scalarNode('version')
->example("version: '20.0.1'")
->info('Optional: The keycloak version to run against')
->end()
;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Security/Exception/FinishRegistrationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class FinishRegistrationException extends AuthenticationException
* @param int $code
* @param \Exception $previous
*/
public function __construct($userInfo, $message = '', $code = 0, Exception $previous = null)
public function __construct($userInfo, $message = '', $code = 0, \Exception $previous = null)
{
$this->userInformation = $userInfo;

Expand Down
9 changes: 4 additions & 5 deletions src/Security/Helper/FinishRegistrationBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
namespace KnpU\OAuth2ClientBundle\Security\Helper;

use KnpU\OAuth2ClientBundle\Security\Exception\FinishRegistrationException;
use LogicException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\SessionInterface;

Expand All @@ -24,13 +23,13 @@ trait FinishRegistrationBehavior
/**
* Call this from within your onAuthenticationFailure() method.
*
* @throws LogicException
* @throws \LogicException
*/
protected function saveUserInfoToSession(Request $request, FinishRegistrationException $e)
{
// save the user information!
if (!$request->hasSession() || !$request->getSession() instanceof SessionInterface) {
throw new LogicException('In order to save user info, you must have a session available.');
throw new \LogicException('In order to save user info, you must have a session available.');
}
$session = $request->getSession();

Expand All @@ -45,12 +44,12 @@ protected function saveUserInfoToSession(Request $request, FinishRegistrationExc
*
* @return mixed
*
* @throws LogicException
* @throws \LogicException
*/
public function getUserInfoFromSession(Request $request)
{
if (!$request->hasSession() || !$request->getSession() instanceof SessionInterface) {
throw new LogicException('In order to have saved user info, you must have a session available.');
throw new \LogicException('In order to have saved user info, you must have a session available.');
}
$session = $request->getSession();

Expand Down

0 comments on commit b701e75

Please sign in to comment.