我正在将 Symfony 从 2.8 升级到 3.4,并且我有一个身份验证侦听器。
监听器的构造函数
public function __construct(EntityManager $entityManager, SessionInterface $session, Security $security, LoggerInterface $logger, Redis $redis, $secret)
{
$this->entityManager = $entityManager;
$this->session = $session;
$this->security = $security;
$this->logger = $logger;
$this->redis = $redis;
$this->secret = $secret;
}
Run Code Online (Sandbox Code Playgroud)
在侦听器中调用的请求函数
public function onRequest(GetResponseEvent $event)
{
//Validate token
//Get Authorization Header
$headers = $event->getRequest()->headers;
$authHeader = $headers->get('Authorization');
//Check if Header value starts with 'Bearer'
if($this->startsWith($authHeader, self::$BEARER_HEADER)) {
// Allow request to be processed by controllers
//token handler
} else { …Run Code Online (Sandbox Code Playgroud) 我总是在本地环境中遇到此错误。
HTTP ERROR 503 AuthenticationSupport service missing. Cannot authenticate the request.
URI: /
STATUS: 503
MESSAGE: AuthenticationSupport service missing. Cannot authenticate the request.
SERVLET: org.apache.felix.http.base.internal.dispatch.DispatcherServlet-7eebf294
Run Code Online (Sandbox Code Playgroud)
有人建议删除 crx-start/repository 文件夹中的索引文件,但它对我来说不起作用。甚至无法访问登录页面
我需要将JSONobj 映射到一个类及其数组ArrayList,Android并且它应该包含所有子数据.(也有嵌套的arraylists),我需要再次将更新的数据列表转换为jsonobject
我的json字符串是
{
"type": "already_planted",
"crops": [
{
"crop_id": 1,
"crop_name": "apple",
"crop_details": [
{
"created_id": "2017-01-17",
"questions": [
{
"plants": "10"
},
{
"planted_by": "A person"
}
]
},
{
"created_id": "2017-01-30",
"questions": [
{
"plants": "15"
},
{
"planted_by": "B person"
}
]
}
]
},
{
"crop_id": 2,
"crop_name": "Cashew",
"crop_details": [
{
"created_id": "2017-01-17",
"questions": [
{
"plants": "11"
},
{
"planted_by": "c person"
}
]
}
] …Run Code Online (Sandbox Code Playgroud)