frieser/wsse-authentication-bundle

此包已被废弃且不再维护。未建议替代包。

Symfony2捆绑包,用于实现WSSE身份验证

安装: 144

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 50

类型:symfony-bundle

2.3.3 2013-10-25 08:36 UTC

This package is not auto-updated.

Last update: 2016-08-30 07:30:11 UTC


README

Build Status

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