mirror of
http://124.126.16.154:8888/singularity/hyperf-saml.git
synced 2026-01-15 07:35:07 +08:00
build(composer): 添加了错误码和对应的语言包
This commit is contained in:
@@ -20,8 +20,11 @@
|
||||
"require": {
|
||||
"php": "~8.0",
|
||||
"hyperf/config": "^2.2",
|
||||
"hyperf/constants": "^2.2",
|
||||
"hyperf/di": "2.2.*",
|
||||
"hyperf/http-server": "2.2.*",
|
||||
"hyperf/translation": "^2.2",
|
||||
"hyperf/validation": "^2.2",
|
||||
"lightsaml/lightsaml": "^2.1",
|
||||
"teapot/status-code": "^1.1"
|
||||
},
|
||||
|
||||
16
publish/languages/en/saml_error.php
Normal file
16
publish/languages/en/saml_error.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* saml_error.php@HyperfSaml
|
||||
*
|
||||
* @author 李东云<dongyun.li@luxcreo.cn>
|
||||
* Powered by PhpStorm
|
||||
* Created on 2022/4/25
|
||||
*/
|
||||
|
||||
return [
|
||||
'default' => 'SAML format error',
|
||||
'params' => [
|
||||
'default' => 'SAML parameters missing',
|
||||
'saml_request' => 'SAMLRequest is required',
|
||||
],
|
||||
];
|
||||
16
publish/languages/zh_CN/saml_error.php
Normal file
16
publish/languages/zh_CN/saml_error.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* saml_error.php@HyperfSaml
|
||||
*
|
||||
* @author 李东云<dongyun.li@luxcreo.cn>
|
||||
* Powered by PhpStorm
|
||||
* Created on 2022/4/25
|
||||
*/
|
||||
|
||||
return [
|
||||
'default' => 'SAML 检验失败',
|
||||
'params' => [
|
||||
'default' => 'SAML 参数校验失败',
|
||||
'saml_request' => 'SAMLRequest 参数不能为空',
|
||||
],
|
||||
];
|
||||
@@ -41,7 +41,19 @@ class ConfigProvider
|
||||
// 建议默认配置放在 publish 文件夹中,文件命名和组件名称相同
|
||||
'source' => __DIR__ . '/../publish/saml.php', // 对应的配置文件路径
|
||||
'destination' => BASE_PATH . '/config/autoload/saml.php', // 复制为这个路径下的该文件
|
||||
]
|
||||
],
|
||||
[
|
||||
'id' => 'languages_cn',
|
||||
'description' => 'The SAML error message for Chinese',
|
||||
'source' => __DIR__ . '/../publish/languages/zh_CN/saml_error.php',
|
||||
'destination' => BASE_PATH . '/storage/languages/zh_CN/saml_error.php'
|
||||
],
|
||||
[
|
||||
'id' => 'languages_en',
|
||||
'description' => 'The SAML error message for English',
|
||||
'source' => __DIR__ . '/../publish/languages/en/saml_error.php',
|
||||
'destination' => BASE_PATH . '/storage/languages/en/saml_error.php'
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
42
src/Constants/SamlErrorCode.php
Normal file
42
src/Constants/SamlErrorCode.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* SamlErrorCode.php@HyperfSaml
|
||||
*
|
||||
* @author 李东云<dongyun.li@luxcreo.cn>
|
||||
* Powered by PhpStorm
|
||||
* Created on 2022/4/25
|
||||
*/
|
||||
|
||||
namespace Singularity\HyperfSaml\Constants;
|
||||
|
||||
use Hyperf\Constants\AbstractConstants;
|
||||
|
||||
/**
|
||||
* SAML 相关错误码
|
||||
* Singularity\HyperfSaml\Constants\SamlErrorCode@HyperfSaml
|
||||
*
|
||||
* @author 李东云<dongyun.li@luxcreo.cn>
|
||||
* Powered by PhpStorm
|
||||
* Created on 2022/4/25
|
||||
*/
|
||||
class SamlErrorCode extends AbstractConstants
|
||||
{
|
||||
|
||||
// 203 SAML 鉴权
|
||||
/**
|
||||
* @Message("saml_error.auth.saml.default")
|
||||
*/
|
||||
public const AUTH_SAML_ERROR = 203000;
|
||||
|
||||
// 20301 验证
|
||||
/**
|
||||
* @Message("saml_error.auth.saml.params.default")
|
||||
*/
|
||||
public const AUTH_SAML_REQUEST_PARAMS_ERROR = 2030100;
|
||||
|
||||
/**
|
||||
* @Message("saml_error.auth.saml.params.saml_request")
|
||||
*/
|
||||
public const AUTH_SAML_REQUEST_PARAMS_SAML_REQUEST = 2030101;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user