@@ -24,10 +24,10 @@ |
||
| 24 | 24 | { |
| 25 | 25 | $loader = new YamlFileLoader( |
| 26 | 26 | $container, |
| 27 | - new FileLocator( __DIR__ . '/../Resources/config' ) |
|
| 27 | + new FileLocator(__DIR__.'/../Resources/config') |
|
| 28 | 28 | ); |
| 29 | 29 | |
| 30 | 30 | // New services |
| 31 | - $loader->load( 'services.yml' ); |
|
| 31 | + $loader->load('services.yml'); |
|
| 32 | 32 | } |
| 33 | 33 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * Note that the list of attributes gotten from ladp is decided by settings for the client class... |
| 24 | 24 | * @todo store the password salted and encrypted in memory instead of plaintext |
| 25 | 25 | */ |
| 26 | - public function __construct($authUserResult, $emailField, $login, $password='') |
|
| 26 | + public function __construct($authUserResult, $emailField, $login, $password = '') |
|
| 27 | 27 | { |
| 28 | 28 | $this->username = $login; |
| 29 | 29 | $this->password = $password; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | protected function ldap2array($data) { |
| 73 | 73 | //return $data; |
| 74 | - foreach($data as $key => $value) { |
|
| 74 | + foreach ($data as $key => $value) { |
|
| 75 | 75 | if ($key === 'dn') { |
| 76 | 76 | continue; |
| 77 | 77 | } |
@@ -91,14 +91,14 @@ |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | if ($search['count'] > 1) { |
| 94 | - if ($this->logger) $this->logger->warning('More than one ldap account found for ' . $username); |
|
| 94 | + if ($this->logger) $this->logger->warning('More than one ldap account found for '.$username); |
|
| 95 | 95 | |
| 96 | 96 | throw new AuthenticationServiceException('More than one user found'); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | // always carry out this check, as the data is needed to log in |
| 100 | 100 | if (!isset($this->settings['ldap_login_attribute']) || !isset($search[0][$this->settings['ldap_login_attribute']][0])) { |
| 101 | - if ($this->logger) $this->logger->info("Authentication failed for user: '$username', missing attribute used to log in to ldap: " . @$this->settings['ldap_login_attribute']); |
|
| 101 | + if ($this->logger) $this->logger->info("Authentication failed for user: '$username', missing attribute used to log in to ldap: ".@$this->settings['ldap_login_attribute']); |
|
| 102 | 102 | |
| 103 | 103 | throw new AuthenticationServiceException('Invalid user profile: missing ldap attribute needed for log-in'); |
| 104 | 104 | } |
@@ -9,13 +9,13 @@ |
||
| 9 | 9 | protected $securityToken = null; |
| 10 | 10 | |
| 11 | 11 | protected function isAuthenticated() { |
| 12 | - if( $this->securityToken == null ) { |
|
| 13 | - $securityToken = $this->container->get( 'security.token_storage' )->getToken(); |
|
| 14 | - if( $securityToken instanceof TokenInterface ) { |
|
| 12 | + if ($this->securityToken == null) { |
|
| 13 | + $securityToken = $this->container->get('security.token_storage')->getToken(); |
|
| 14 | + if ($securityToken instanceof TokenInterface) { |
|
| 15 | 15 | $this->securityToken = $securityToken; |
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - return $this->securityToken->isAuthenticated() === true && count( $this->securityToken->getRoles() ); |
|
| 19 | + return $this->securityToken->isAuthenticated() === true && count($this->securityToken->getRoles()); |
|
| 20 | 20 | } |
| 21 | 21 | } |
@@ -156,10 +156,10 @@ |
||
| 156 | 156 | //$user = $this->userProvider->loadUserByUsername($username); |
| 157 | 157 | return $user; |
| 158 | 158 | |
| 159 | - } catch(AuthenticationException $e) { |
|
| 159 | + } catch (AuthenticationException $e) { |
|
| 160 | 160 | // let through any exception of the expected authentication type |
| 161 | 161 | throw $e; |
| 162 | - } catch(\Exception $e) { |
|
| 162 | + } catch (\Exception $e) { |
|
| 163 | 163 | // we mask any internal, unexpected error from the Client |
| 164 | 164 | /// @todo we should log a message here: the Client used an unexpected exception type... |
| 165 | 165 | /// @tood we should really be using an AuthenticationServiceException here |
@@ -108,7 +108,7 @@ |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | } catch (\Exception $e) { |
| 111 | - if ($this->logger) $this->logger->error("Unexpected error while finding/creating/updating repo user from data gotten from remote service: " . $e->getMessage()); |
|
| 111 | + if ($this->logger) $this->logger->error("Unexpected error while finding/creating/updating repo user from data gotten from remote service: ".$e->getMessage()); |
|
| 112 | 112 | throw $e; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $newUserGroups = $this->getGroupsFromProfile($profile); |
| 135 | 135 | $currentUserGroups = $userService->loadUserGroupsOfUser($eZUser); |
| 136 | 136 | $groupsToRemove = array(); |
| 137 | - foreach($currentUserGroups as $currentUserGroup) { |
|
| 137 | + foreach ($currentUserGroups as $currentUserGroup) { |
|
| 138 | 138 | if (!array_key_exists($currentUserGroup->id, $newUserGroups)) { |
| 139 | 139 | $groupsToRemove[] = $currentUserGroup; |
| 140 | 140 | } else { |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | protected function getRemoteIdFromProfile($profile) |
| 166 | 166 | { |
| 167 | - return $this->remoteIdPrefix . $this->profileHash($profile); |
|
| 167 | + return $this->remoteIdPrefix.$this->profileHash($profile); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @param string $prefix |
| 212 | 212 | * @return string |
| 213 | 213 | */ |
| 214 | - protected function createTempFile($data, $prefix='') |
|
| 214 | + protected function createTempFile($data, $prefix = '') |
|
| 215 | 215 | { |
| 216 | 216 | $imageFileName = trim(tempnam(sys_get_temp_dir(), $prefix), '.'); |
| 217 | 217 | file_put_contents($imageFileName, $data); |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | protected function cleanUpAfterUserCreation() |
| 227 | 227 | { |
| 228 | 228 | foreach ($this->tempFiles as $fileName) { |
| 229 | - if (is_file( $fileName)) |
|
| 229 | + if (is_file($fileName)) |
|
| 230 | 230 | unlink($fileName); |
| 231 | 231 | } |
| 232 | 232 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | protected function cleanUpAfterUserUpdate() |
| 238 | 238 | { |
| 239 | 239 | foreach ($this->tempFiles as $fileName) { |
| 240 | - if (is_file( $fileName)) |
|
| 240 | + if (is_file($fileName)) |
|
| 241 | 241 | unlink($fileName); |
| 242 | 242 | } |
| 243 | 243 | } |
@@ -14,23 +14,23 @@ discard block |
||
| 14 | 14 | * @param bool $authenticationMatch |
| 15 | 15 | * @return bool|mixed |
| 16 | 16 | */ |
| 17 | - static function loginUser( $login, $password, $authenticationMatch = false ) |
|
| 17 | + static function loginUser($login, $password, $authenticationMatch = false) |
|
| 18 | 18 | { |
| 19 | - $user = self::_loginUser( $login, $password, $authenticationMatch ); |
|
| 19 | + $user = self::_loginUser($login, $password, $authenticationMatch); |
|
| 20 | 20 | |
| 21 | - if ( is_object( $user ) ) |
|
| 21 | + if (is_object($user)) |
|
| 22 | 22 | { |
| 23 | - self::loginSucceeded( $user ); |
|
| 23 | + self::loginSucceeded($user); |
|
| 24 | 24 | return $user; |
| 25 | 25 | } |
| 26 | 26 | else |
| 27 | 27 | { |
| 28 | - self::loginFailed( $user, $login ); |
|
| 28 | + self::loginFailed($user, $login); |
|
| 29 | 29 | return false; |
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - protected static function _loginUser( $login, $password, $authenticationMatch = false ) |
|
| 33 | + protected static function _loginUser($login, $password, $authenticationMatch = false) |
|
| 34 | 34 | { |
| 35 | 35 | $fwName = eZINI::instance('identitymanagement.ini')->variable('GeneralSettings', 'FirewallName'); |
| 36 | 36 | |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | return self::fetch($user->id); |
| 62 | 62 | |
| 63 | - } catch(\Exception $e) { |
|
| 63 | + } catch (\Exception $e) { |
|
| 64 | 64 | /// @todo make it easier to tell apart system error from user errors such as bad password... |
| 65 | 65 | |
| 66 | - eZDebug::writeError($e->getMessage(), __METHOD__ ); |
|
| 66 | + eZDebug::writeError($e->getMessage(), __METHOD__); |
|
| 67 | 67 | |
| 68 | 68 | return false; |
| 69 | 69 | } |
@@ -1,5 +1,1 @@ |
||
| 1 | -<?php /* |
|
| 2 | - |
|
| 3 | -[UserSettings] |
|
| 4 | -ExtensionDirectory[]=identitymanagementextension |
|
| 5 | -LoginHandler[]=RemoteUserLogin |
|
| 6 | 1 | \ No newline at end of file |
| 2 | +<?php |
|
| 7 | 3 | \ No newline at end of file |
@@ -1,5 +1,1 @@ |
||
| 1 | -<?php /* |
|
| 2 | - |
|
| 3 | -[UserSettings] |
|
| 4 | -ExtensionDirectory[]=identitymanagementextension |
|
| 5 | -LoginHandler[]=RemoteUserLogin |
|
| 6 | 1 | \ No newline at end of file |
| 2 | +<?php |
|
| 7 | 3 | \ No newline at end of file |