小编end*_*unc的帖子

如何在Spring Security 3中设置用户角色?

我正在研究JAVA EE技术以学习JSF-Spring-Hibernate vs ...我正在尝试使用不同的用户角色来执行Web应用程序.现在,我只有一个用户角色ROLE_USER.我无法改变这个角色.我尝试使用debug mod来理解我们如何设置这个角色,但我无法理解它在哪里发生.

所以,我的主要问题是我无法在我的应用程序中创建任何其他ROLE.如果我不使用<secured attributes="ROLE_USER" />我的流程(我使用spring web-flow),每个人都可以访问该页面.如果我只做ROLE_USER.但我想创建一个名为ROLE_ADMIN的新角色,只让ROLE_ADMIN到达该页面.

注意:我没有在这里添加所有文件因为我说只添加相关的类和文件.如果您需要更多信息,请告诉我.

这是我正在遵循的教程soruce代码. https://code.google.com/p/jee-tutorial-youtube/source/browse/

安全-config.xml中

<?xml version="1.0" encoding="UTF-8"?>
Run Code Online (Sandbox Code Playgroud)

<security:http auto-config="true">
    <security:form-login login-page="/app/main"
        default-target-url="/app/account" />
    <security:logout logout-url="/app/logout"
        logout-success-url="/app/main" />
</security:http>

<security:authentication-manager>
    <security:authentication-provider
        user-service-ref="userServiceImp">
        <security:password-encoder hash="md5" />
    </security:authentication-provider>
</security:authentication-manager>

<bean id="daoAuthenticationProvider"
    class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
    <property name="userDetailsService" ref="userServiceImp" />
    <property name="hideUserNotFoundExceptions" value="false" />
</bean>

<bean id="authenticationManager"
    class="org.springframework.security.authentication.ProviderManager">
    <constructor-arg>
        <ref bean="daoAuthenticationProvider" />
    </constructor-arg>
</bean>
Run Code Online (Sandbox Code Playgroud)

这是我的UserAuthenticationProviderServiceImp类,我在其中验证用户身份.

 public boolean processUserAuthentication(Users user) {

        try {
                Authentication request = new UsernamePasswordAuthenticationToken(user.getUserName(), user.getPassword());
                Authentication result = authenticationManager.authenticate(request);
                SecurityContextHolder.getContext().setAuthentication(result);

                return true;
        } …
Run Code Online (Sandbox Code Playgroud)

authentication spring roles spring-security spring-webflow-2

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

是否可以使用Elastic Beanstlak添加多个自动缩放策略

我们使用ElasticBeanstalk实现了部署生命周期的自动化,除了一件事我们感到高兴.我们希望有多个自动扩展策略,如CPU使用率和网络流量,但似乎我们只需要选择其中一个指标.

我们目前正在使用名为eb_deployer的开源工具,它支持以下链接中列出的配置:http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html#command-options-general- autoscalingtrigger

据我们所知,我们只能制定一项政策 aws:autoscaling:trigger

我们也寻找.ebextensions,但似乎.ebextension在这个问题上也有相同的限制.所以,我们想知道有没有办法在ElasticBeanstalk中使用多个自动扩展策略?

amazon-web-services amazon-elastic-beanstalk

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

如何在Amazon Cognito中禁用某些用户的验证?

如果激活验证功能,Amazon Cognito会自动发送验证码.在我的项目中,有时候,我会添加用户(AWS Java SDK中的注册功能)并自己通过AdminConfirmSignup验证它们,所以我不希望它们接收验证邮件.我会手动发送定制的电子邮件.(不使用cognito中的自定义lambda)

如果我在该阶段编写预注册lambda函数并验证用户,他们是否仍会收到验证邮件?

我怎样才能实现目标?

amazon-cognito

5
推荐指数
2
解决办法
4770
查看次数