我有用Symfony 2.8.11和FosUserBundle 2.0.0-beta1编写的应用程序.用户可以通过VPN或基本身份验证连接到站点.大多数情况下,他们在Windows 7上使用Internet Explorer 11.其中一些在站点内以随机形式遇到无效的CSRF令牌问题.问题是用户无法提交表单,即使刷新页面几次也是如此.
我怀疑问题是由日志中的会话持续刷新引起的:
{
"created":1483610056,
"lastUsed":1483610056
} ["csrf","session_times"] []
Run Code Online (Sandbox Code Playgroud)
此外,我怀疑它是由记住我令牌的身份验证引起的(每个问题都已被该令牌验证):
[2017-01-05 10:54:16] security.DEBUG: Remember-me cookie detected. [] []
[2017-01-05 10:54:16] security.INFO: Remember-me cookie accepted. [] []
[2017-01-05 10:54:16] security.DEBUG: Populated the token storage with a remember-me token. [] []
Run Code Online (Sandbox Code Playgroud)
我的安全配置:
...
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
# if you are using Symfony < 2.8, use the following config instead:
# csrf_provider: form.csrf_provider
logout: true
anonymous: true
remember_me:
name: "%session_cookie_remember_name%"
domain: "%session_cookie_domain%"
key: "%secret%" …Run Code Online (Sandbox Code Playgroud) 当我构建应用程序
./gradlew assembleRelease
时,我收到此警告:
ASM Instrumentation process wasn't able to resolve some classes, this means that
the instrumented classes might contain corrupt stack frames. Make sure the
dependencies that contain these classes are on the runtime or the provided
classpath. Otherwise, the jvm might fail to load the corrupt classes at runtime
when running in a jvm environment like unit tests.
Classes that weren't resolved:
> sun.misc.Unsafe
> androidx.appcompat.view.ContextThemeWrapper
> com.google.common.util.concurrent.ListenableFuture
> retrofit2.Response
> javax.mail.internet.MimeBodyPart
> javax.naming.NamingException
> javax.naming.directory.Attributes
Run Code Online (Sandbox Code Playgroud)
我目前使用的是 …
我有两个实体 - 律师和类别.它们与多对多关联.假设示例律师有3个类别.我想通过一系列类别来创建搜索律师的功能,并且它应该只返回拥有阵列所有类别的律师.
class Lawyer {
//...
/**
* @ORM\ManyToMany(targetEntity="Dees\KancelariaBundle\Entity\Category")
* @ORM\JoinTable(name="lawyers_has_categories",
* joinColumns={@ORM\JoinColumn(name="lawyer_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="category_id", referencedColumnName="id")}
* )
*
* @var ArrayCollection
*/
protected $categories = null;
//...
}
class Category {
//...
/**
* @ORM\Column(length=255, nullable=true)
*
* @var string
*/
protected $name;
//...
}
public function searchLawyers(array $categories) {
$queryBuilder = $this->createQueryBuilder('lawyer')
->join('lawyer.categories', 'category');
$queryBuilder->andWhere("category.name = :category1");
$queryBuilder->setParameter("category1", "First category");
$queryBuilder->andWhere("category.name = :category2");
$queryBuilder->setParameter("category2", "Second category");
//...
//won't work, return null, but lawyer with these categories …Run Code Online (Sandbox Code Playgroud)