Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

no_auth.php
Go to the documentation of this file.
1 <?php
16 class ezpRestNoAuthStyle extends ezpRestAuthenticationStyle implements ezpRestAuthenticationStyleInterface
17 {
21 public function setup( ezcMvcRequest $request )
22 {
23 // Use either rest.ini/[Authentication].DefaultUserID if provided, or AnonymousUserID
24 $defaultUserID = (int)eZINI::instance()->variable( 'UserSettings', 'AnonymousUserID' );
25 $restDefaultUserID = eZINI::instance( 'rest.ini' )->variable( 'Authentication', 'DefaultUserID' );
26 if ( $restDefaultUserID !== '' )
27 {
28 $defaultUserID = (int)$restDefaultUserID;
29 }
30
31 $cred = new ezcAuthenticationIdCredentials( $defaultUserID );
32 $auth = new ezcAuthentication( $cred );
33 $auth->addFilter( new ezpNativeUserAuthFilter() );
34
35 return $auth;
36 }
37
41 public function authenticate( ezcAuthentication $auth, ezcMvcRequest $request )
42 {
43 if ( !$auth->run() && $request->uri !== "{$this->prefix}/fatal" ) // /fatal URI should never fail
44 {
45 throw new ezpUserNotFoundException( $auth->credentials->id );
46 }
47 else
48 {
49 return eZUser::fetch( $auth->credentials->id );
50 }
51 }
52 }
53 ?>
ezpNativeUserAuthFilter
Definition: native_user_authfilter.php:12
ezpRestAuthenticationStyle
Definition: abstract_auth_style.php:12
ezpRestNoAuthStyle
Definition: no_auth.php:17
ezpRestNoAuthStyle\setup
setup(ezcMvcRequest $request)
Definition: no_auth.php:21
ezpRestNoAuthStyle\authenticate
authenticate(ezcAuthentication $auth, ezcMvcRequest $request)
Definition: no_auth.php:41
ezpUserNotFoundException
Definition: user_not_found.php:12
ezpRestAuthenticationStyleInterface
Definition: auth_style.php:13
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.