Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
Zend_Auth_Storage_NonPersistent example
$adapter
->
setDigestResolver
(
new
StaticResolver
(
$this
->
get
(
ModelManager::
class
)
)
)
;
$adapter
->
setRequest
(
$this
->request
)
;
$adapter
->
setResponse
(
$this
->response
)
;
$resource
= Shopware_Components_Auth::
getInstance
(
)
;
$storage
=
new
Zend_Auth_Storage_NonPersistent
(
)
;
$resource
->
setBaseAdapter
(
$adapter
)
;
$resource
->
addAdapter
(
$adapter
)
;
$resource
->
setStorage
(
$storage
)
;
return
$resource
;
}
}
public
function
isPasswordValid
(
$username
,
$password
)
{
$storage
=
$this
->
getStorage
(
)
;
$adapters
=
$this
->
getAdapter
(
)
;
$this
->
setStorage
(
new
Zend_Auth_Storage_NonPersistent
(
)
)
;
foreach
(
$adapters
as
$adapter
)
{
$adapter
->
setIdentity
(
$username
)
;
$adapter
->
setCredential
(
$password
)
;
$result
=
$this
->
authenticate
(
$adapter
)
;
if
(
$result
->
isValid
(
)
)
{
$this
->
setStorage
(
$storage
)
;
return
true;
}
}