frieser / wsse-authentication-bundle
此包已被废弃且不再维护。未建议替代包。
Symfony2捆绑包,用于实现WSSE身份验证
2.3.3
2013-10-25 08:36 UTC
Requires
- php: >=5.3.2
Requires (Dev)
- symfony/finder: 2.3.*@dev
- symfony/framework-bundle: 2.3.*
- symfony/security-bundle: 2.3.*
This package is not auto-updated.
Last update: 2016-08-30 07:30:11 UTC
README
The EscapeWSSEAuthentication bundle是一个简单易用的方式,在Symfony2应用中实现WSSE身份验证
安装
composer.json
"require": {
...
"escapestudios/wsse-authentication-bundle": "2.3.x-dev",
...
}
app/AppKernel.php
public function registerBundles()
{
return array(
//...
new Escape\WSSEAuthenticationBundle\EscapeWSSEAuthenticationBundle(),
//...
);
...
命令
通过此包提供的escape:wsseauthentication:nonces:delete
命令删除过期的nonces;它需要nonceDir和lifetime作为(必需)参数。
php app/console --env=dev escape:wsseauthentication:nonces:delete /path/to/security/nonces 300
使用示例
app/config/security.yml
firewalls:
wsse_secured:
pattern: ^/api/.*
wsse:
nonce_dir: null #location where nonces will be saved; use null to skip nonce-validation
lifetime: 300 #lifetime of nonce
realm: "Secured API" #identifies the set of resources to which the authentication information will apply (WWW-Authenticate)
profile: "UsernameToken" #WSSE profile (WWW-Authenticate)
高级配置
指定自定义摘要算法
app/config/security.yml
firewalls:
wsse_secured:
...
wsse:
...
encoder: #digest algorithm
algorithm: sha1
encodeHashAsBase64: true
iterations: 1
指定自定义认证类
app/config/config.yml
# Escape WSSE authentication configuration
escape_wsse_authentication:
authentication_provider_class: Escape\WSSEAuthenticationBundle\Security\Core\Authentication\Provider\Provider
authentication_listener_class: Escape\WSSEAuthenticationBundle\Security\Http\Firewall\Listener
authentication_entry_point_class: Escape\WSSEAuthenticationBundle\Security\Http\EntryPoint\EntryPoint
authentication_encoder_class: Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder