• Zend Framework 2参考ZendAuthentication(摘要式身份验证)


    Zend Framework 2参考ZendAuthentication(摘要式身份验证)

    介绍

    摘要式身份验证是HTTP身份验证的方法,提高了基本身份验证时提供的方式进行身份验证,而无需在网络上以明文传送口令。
    这个适配器的认证包含了摘要式身份验证的基本要素的连续字符串文本:

    • 用户名,像”joe.user
    • 区域,像”Administrative Area
    • 用冒号分割进行MD5哈希化的用户名,区域,密码

    上面的选项用冒号分割,像下面这样(密码用”somePassword“表示):

    1
    someUser:Some Realm:fde17b91c3a510ecbaf7dbd37f59d4f8

    细节

    摘要身份验证适配器,ZendAuthenticationAdapterDigest,需要多个输入参数:

    • 文件名 – 文件名进行认证查询
    • 区域 – 摘要式身份验证区域
    • 用户名 – 摘要式身份验证的用户
    • 密码 – 用户区域的密码

    这些参数必须预先调用authenticate()

    身份

    摘要身份验证适配器返回一个ZendAuthenticationResult对象,这个对象包含了realm username键的数组。在authenticate()调用之前设置了这些数组值。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    use ZendAuthenticationAdapterDigest as AuthAdapter;
     
    $adapter new AuthAdapter($filename,
                               $realm,
                               $username,
                               $password);
     
    $result $adapter->authenticate();
     
    $identity $result->getIdentity();
     
    print_r($identity);
     
    /*
    Array
    (
        [realm] => Some Realm
        [username] => someUser
    )
    */

     

  • 相关阅读:
    leetcode_Basic Calculator II
    leetcode_Basic Calculator
    LeetCode_Add Two Numbers
    LeetCode_Partition List
    LeetCode_Compare Version Numbers
    LeetCode—Longest Consecutive Sequence
    Thrift数据类型
    thrift简介
    grpc与json格式互转
    grpc测试
  • 原文地址:https://www.cnblogs.com/heui/p/3430305.html
Copyright © 2020-2023  润新知