小编use*_*065的帖子

spring security自定义AuthenticationProvider被调用两次并失败

我正在尝试使用带有自定义AuthenticationProvider的spring security实现表单登录.

我正在使用:spring - 4.1.1.RELEASE spring security - 3.2.5.RELEASE tomcat 7

安全的context.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                                 http://www.springframework.org/schema/beans/spring-beans.xsd
                                 http://www.springframework.org/schema/security 
                                 http://www.springframework.org/schema/security/spring-security.xsd">

    <!-- <http create-session="stateless" authentication-manager-ref="authenticationManager" 
        entry-point-ref="reportsAuthenticationEntryPoint" disable-url-rewriting="true" 
        use-expressions="true" pattern="/report/**"> <intercept-url pattern="/report/**" 
        /> </http> -->

    <http auto-config="true" use-expressions="true">
        <intercept-url pattern="/reports/**" access="isAuthenticated()" />
    </http>

    <beans:bean id="reportsAuthenticationEntryPoint" class="com.test.reporting.web.security.ReportsAuthenticationEntryPoint" />

    <beans:bean id="reportsAuthenticationProvider" class="com.test.reporting.web.security.ReportsAuthenticationProvider" />

    <authentication-manager erase-credentials="true" alias="authenticationManager">
        <authentication-provider ref="reportsAuthenticationProvider" />
    </authentication-manager>

</beans:beans>
Run Code Online (Sandbox Code Playgroud)

我正在实现我的自定义AuthenticationProvider:

public class ReportsAuthenticationProvider implements AuthenticationProvider
{
    private static final Logger logger = LoggerFactory.getLogger(ReportsAuthenticationProvider.class);

    @Inject
    private ProviderDao providerDao;

    @Override
    public …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc spring-security

6
推荐指数
1
解决办法
5479
查看次数

在 Azure 入口上的标头中启用下划线

我遇到了标头未转发到我的服务中的问题,我不确定如何添加对 Ingress 的支持,但是我有以下 Ingress 服务:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    ingress.kubernetes.io/rewrite-target: /
    "nginx.org/proxy-pass-headers": "custom_header"
spec:
  rules:
  - host: myingress.westus.cloudapp.azure.com
    http:
      paths:
      - path: /service1
        backend:
          serviceName: service1
          servicePort: 8080
Run Code Online (Sandbox Code Playgroud)

但是,我的custom_header不会被转发。在 nginx 中我设置了 underscores_in_headers:

underscores_in_headers on;
Run Code Online (Sandbox Code Playgroud)

如何将此配置添加到我的 ingress nginx 服务中?

谢谢。

azure kubernetes

6
推荐指数
2
解决办法
7776
查看次数

使用高级API从特定偏移量开始读取kafka消息

我希望我没有犯错,但是我记得在Kafka文档中它提到使用高级API不能从特定的偏移量开始读取消息,但是有人提到它会发生变化。

现在是否可以使用高级API从特定分区和特定偏移量读取消息?请给我一个例子,怎么做?

我正在使用kafka 0.8.1.1。

提前致谢。

apache-kafka

4
推荐指数
1
解决办法
2万
查看次数

django 应用程序正在运行,但未包含在 settings.py 中

我正在他们的网站上阅读 django 的教程。

在第一个教程https://docs.djangoproject.com/en/2.1/intro/tutorial01/ 中,他们正在创建一个名为polls的应用程序和一个视图,并在运行服务器时显示视图。

但是,在第二个教程https://docs.djangoproject.com/en/2.1/intro/tutorial02/中提到应将应用程序添加到 settings.py 的已安装应用程序部分

要将应用程序包含在我们的项目中,我们需要在 INSTALLED_APPS 设置中添加对其配置类的引用。PollsConfig 类位于 polls/apps.py 文件中,因此它的虚线路径是“polls.apps.PollsConfig”。编辑 mysite/settings.py 文件并将虚线路径添加到 INSTALLED_APPS 设置。

我不确定它在第一个教程中是如何工作的,而没有包含该应用程序。不是必须包含应用程序吗?还是仅在特定用例中是强制性的?

谢谢

django

2
推荐指数
1
解决办法
218
查看次数