notakey / simplesamlphp-module-autoauth
SimpleSAMLphp 自动认证源选择模块。
1.1.3
2020-05-09 11:19 UTC
Requires
- php: >=5.5.9
- simplesamlphp/composer-module-installer: ^1.0
This package is auto-updated.
Last update: 2024-09-09 20:41:35 UTC
README
允许通过指定源IP地址范围或匹配用户代理来自动选择认证源。目的是改善AD FS内网/外网定义,避免每次用户认证时都显示HDR,因为HDR选择错误对用户来说很难克服。
autoauth:AutoAuth
: 使用认证源列表对用户进行认证。
autoauth:AutoAuth
要创建自动认证源,在文本编辑器中打开 config/authsources.php
,并为认证源添加条目
'example-auto' => array(
'autoauth:AutoAuth',
/*
* The available authentication sources.
* They must be defined in this authsources.php file.
*/
'sources' => array(
'example-saml' => array(
"preauth-source" => "ad-ldap",
"preauth-duration" => "P1Y"
),
'example-admin' => array(
'subnets' => array('127.0.0.0/24', '10.0.1.0/24'),
),
'example-boo' => array(
'subnets' => array('192.168.0.0/16'),
),
),
'default' => 'example-saml'
),
'example-saml' => array(
'saml:SP',
'entityId' => 'my-entity-id',
'idp' => 'my-idp',
),
'example-admin' => array(
'core:AdminPassword',
),
'example-boo' => array(
'core:AdminPassword',
),
在任意认证源选项定义中可选的 preauth-source 配置允许在令牌持续期间进行额外的用户验证。用户ID的属性必须在认证源中匹配,并必须使用 preauth-uid 配置,默认为 uid。预认证持续时间选项设置颁发令牌的有效期。
令牌目前是从服务器端私钥派生的cookie,并在任何新的认证流程中进行验证。如果服务器密钥更改,所有客户端设备都需要重新认证。
Notakey 认证设备
如果运行在 NAA 环境中,请使用 cli 进行配置
# Configure module authentication sources
# autoselect can be any name for this virtual auth source
ntk cfg set :sso.auth.autoselect '{
"module": "autoauth:AutoAuth",
"sources": {
"adfs-wia": {
"subnets": ["172.17.0.0/24", "192.168.2.0/24"]
},
"notakey": {
"subnets": ["20.0.0.0/24", "202.168.2.0/24"],
-- another source defined in :sso.auth
"preauth-source": "ad-ldap",
-- store session token for one year
"preauth-duration": "P1Y",
"preauth-user-attr": "uid",
"preauth-set-attr": "notakey:preauth-uid"
}
},
"default": "notakey",
"ipsource": "HTTP_X_REAL_IP"
}' --json-input
# Enable module
ntk cfg set :sso.modules '[..., "autoauth"]' --json-input
# Switch to this source for your IdP
ntk cfg set :sso.\"saml-idp\".\"<IdP ID>\".auth "autoselect"