为啥找不到j_spring_security_check咧?居然报404~-问答-阿里云开发者社区-阿里云

开发者社区> a123456678> 正文

为啥找不到j_spring_security_check咧?居然报404~

2016-03-17 14:42:04 4267 1
不知道xml哪里配得不对,在表单action的j_spring_security_check,老是跳转不过去,找不到j_spring_security_check,报404.

<%=request.getContextPath() %>/j_spring_security_check之类的方式都试过了,没用。

依然报404

<?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"
    xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
                        http://www.springframework.org/schema/jdbc  http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
                        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
        <http pattern="/common/**" security="none" />
    <http pattern="/css/**" security="none" />
    <http pattern="/images/**" security="none" />
    <http pattern="/js/**" security="none" />
    <http pattern="/login**" security="none"/>
    <http pattern="/manager_login.action" security="none"/>
     
    <http auto-config="true" use-expressions="true">
        <!-- 访问无权限时处理 -->
        <access-denied-handler ref="accessDeniedHandler" />
 
        <!-- 允许所有身份访问的路径 -->
         <intercept-url pattern="/**" access="permitAll"/> 
 
        <!-- 无受权路径任何人都不能访问 -->
        <intercept-url pattern="/securityExample/nobody" access="denyAll" />
         
        <!-- 定义模块可访问所需的资源 -->
        <intercept-url pattern="/admin/add" access="hasRole('/admin/add')"/>
        <intercept-url pattern="/admin/update" access="hasRole('/admin/update')"/>
        <intercept-url pattern="/admin/modify" access="hasRole('/admin/modify')"/>
        <intercept-url pattern="/admin/delete" access="hasRole('/admin/delete')"/>
        <intercept-url pattern="/admin/handle" access="hasRole('/admin/handle')"/>
         
        <intercept-url pattern="/doctor/add" access="hasRole('/doctor/add')"/>
        <intercept-url pattern="/doctor/update" access="hasRole('/doctor/update')"/>
        <intercept-url pattern="/doctor/modify" access="hasRole('/doctor/modify')"/>
        <intercept-url pattern="/doctor/delete" access="hasRole('/doctor/delete')"/>
        <intercept-url pattern="/doctor/handle" access="hasRole('/doctor/handle')"/>
         
        <intercept-url pattern="/article/add" access="hasRole('/article/add')"/>
        <intercept-url pattern="/article/update" access="hasRole('/article/update')"/>
        <intercept-url pattern="/article/modify" access="hasRole('/article/modify')"/>
        <intercept-url pattern="/article/delete" access="hasRole('/article/delete')"/>
        <intercept-url pattern="/article/handle" access="hasRole('/article/handle')"/>
         
        <intercept-url pattern="/cs/add" access="hasRole('/cs/add')"/>
        <intercept-url pattern="/cs/update" access="hasRole('/cs/update')"/>
        <intercept-url pattern="/cs/modify" access="hasRole('/cs/modify')"/>
        <intercept-url pattern="/cs/delete" access="hasRole('/cs/delete')"/>
        <intercept-url pattern="/cs/handle" access="hasRole('/cs/handle')"/>
         
         
        <!-- 允许所有己验证用户访问所有文件夹 -->
        <!-- <intercept-url pattern="/**/*" access="authenticated" />
 
        登录退出页面控制
        <form-login login-page="/login" authentication-failure-url="/login?error=true"
            default-target-url="/index" always-use-default-target='true'
            login-processing-url="/login_url" />
        <logout invalidate-session="true" logout-success-url="/login"
            logout-url="/logout_url" /> -->
             
        <form-login login-page="/login.jsp"
                    login-processing-url="/medical/manager_login.action"
                    authentication-failure-url="/manager_login.action?error=1"/>
    </http>
 
    <!-- 验证管理器负责验证用户凭证 -->
    <authentication-manager >
        <!-- 用户密码用md5加密  -->
        <!-- <authentication-provider user-service-ref="jdbcUserService">
            <password-encoder hash="md5" />
        </authentication-provider> -->
        <authentication-provider>
            <password-encoder hash="plaintext"/>
            <user-service>
                <user name="admin3" authorities="ROLE_ADMIN" password="123456"/>
            </user-service>
        </authentication-provider>
    </authentication-manager>
     
     
</beans:beans>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Application context definition for PetClinic Datasource. -->
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:p="http://www.springframework.org/schema/p" xmlns:jaxws="http://cxf.apache.org/jaxws"
    xmlns:cxf="http://cxf.apache.org/core"
    xsi:schemaLocation="http://www.springframework.org/schema/beans  
           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd  
           http://www.springframework.org/schema/aop   
           http://www.springframework.org/schema/aop/spring-aop-2.5.xsd  
           http://www.springframework.org/schema/context  
           http://www.springframework.org/schema/context/spring-context-2.5.xsd    
           http://www.springframework.org/schema/tx   
           http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
           http://cxf.apache.org/jaxws     
           http://cxf.apache.org/schemas/jaxws.xsd     
           http://cxf.apache.org/core     
           http://cxf.apache.org/schemas/core.xsd
           ">
 
    <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" />
    <!-- 自动扫描com.toceansoft.模块.dao包下所有标注@Repository的DAO组件(自动注入) -->
    <context:component-scan base-package="com.toceansoft.medical.*.dao.impl" />
    <!-- 自动扫描com.hiting.service包下所有标注@Service的服务组件 -->
    <context:component-scan base-package="com.toceansoft.medical.*.service.impl" />
    <context:component-scan base-package="com.toceansoft.medical.webservice.*.cxf.service.impl" />
    <context:component-scan base-package="com.toceansoft.medical.webservice.login.cxf.tokonservice.impl" />
    <!-- 自动扫描@Controller标注的类控制器类 -->
    <context:component-scan base-package="com.toceansoft.medical.*.web" />
    <context:component-scan
        base-package="com.toceansoft.medical.webservice.*.cxf.action" />
 
 
    <!-- 加载配置文件 -->
    <!-- <context:property-placeholder location="classpath:/spring/resources.properties" /> -->
 
    <!-- c3p0配置 -->
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
        destroy-method="close">
        <property name="driverClass" value="com.mysql.jdbc.Driver" />
        <property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3306/medical" />
        <property name="user" value="root" />
        <property name="password" value="740762239" />
 
        <!--连接池中保留的最大连接数。Default: 15 -->
        <property name="maxPoolSize" value="15" />
 
        <!--连接池中保留的最小连接数。 -->
        <property name="minPoolSize" value="20" />
 
        <!--初始化时获取的连接数,取值应在minPoolSize与maxPoolSize之间。Default: 3 -->
        <property name="initialPoolSize" value="2" />
 
        <!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
        <property name="maxIdleTime" value="30" />
 
    </bean>
 
    <!-- spring jdbc -->
    <!-- <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
        <property name="dataSource" ref="dataSource" />
    </bean> -->
 
    <!-- hibnerate4 -->
    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <!--<qualifier value="sessionFactory"></qualifier>-->
        <property name="dataSource">
            <ref bean="dataSource" />
        </property>
        <property name="packagesToScan">
            <list>
                <value>com.toceansoft.medical.*.bean</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.connection.release_mode">auto</prop>
                <!--<prop key="hbm2ddl.auto">update</prop> -->
            </props>
        </property>
    </bean>
    <bean id="template" class="org.springframework.orm.hibernate3.HibernateTemplate"
        p:sessionFactory-ref="sessionFactory" />
    <!-- 使用hibernate4 事务 -->
    <bean id="transactionManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <bean id="base" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true">  
        <property name="transactionManager" ref="transactionManager">  
        </property>  
        <property name="transactionAttributes">  
         <props>  
             <prop key="*">PROPAGATION_REQUIRED</prop>  
        </props>  
     </property>  
</bean> 
    <!-- 切入点表达式 -->
    <tx:advice id="txAdvice" transaction-manager="transactionManager">
        <tx:attributes>
            <tx:method name="*" propagation="REQUIRED" />
        </tx:attributes>
    </tx:advice>
 
    <!-- 切面 -->
    <aop:config>
        <aop:pointcut id="interceptorPointCuts"
            expression="execution(* com.toceansoft.medical.testdemo.dao.*.*(..))" />
        <aop:advisor advice-ref="txAdvice" pointcut-ref="interceptorPointCuts" />
    </aop:config>
 
    <!-- 切面  Add by Kuby -->
    <aop:config>
        <aop:pointcut id="serviceMethod"
            expression="execution(* com.toceansoft.medical.*.service.impl.*ServiceImpl.*(..))" />
        <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethod" />
    </aop:config>
     
    <tx:annotation-driven />
 
    <!-- 帐号处理类 -->
    <bean id="jdbcUserService"
        class="org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl">
        <property name="dataSource" ref="dataSource" />
        <!-- 使用组授权策略 -->
        <property name="enableGroups" value="true" />
        <!-- 不使用用户授权策略 -->
        <property name="enableAuthorities" value="false" />
 
        <!-- 匹配用户名 -->
        <property name="usersByUsernameQuery">
            <value>
                SELECT `user_name` as 'username', `password`, `is_delete` = 0 as `is_valid`
                FROM `t_admin` WHERE `user_name` = ?
            </value>
        </property>
 
        <!-- 获取用户所在组被授予的权限 -->
        <property name="groupAuthoritiesByUsernameQuery">
            <value>
                select u.r_id as 'role_id', u.r_id as 'role_name',module.module_address as resource_value 
                from t_admin u join t_role_module rm on rm.r_id = u.r_id
                join t_module module on module.m_id = rm.m_id
                where u.user_name = ?
            </value>
        </property>
    </bean>
 
    <!-- 无权限错误提示 -->
    <bean id="accessDeniedHandler" class="com.toceansoft.medical.security.HippoAccessDeniedHandler">
        <property name="accessDenied" value="/accessDenied" />
    </bean>
</beans>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>  
<%@taglib prefix="s" uri="/struts-tags"%>  
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<html>  
    <head>  
    </head>  
    <body>  
        <!-- 使用form标签生成表单元素 --> 
        <form action="j_spring_security_check" method='post'>
            User Name:
        <input name="j_username" value="admin3" size="20" maxlength="50" type="text"/>
        <br />
        Password:
        <input name="j_password" value="123456" size="20" maxlength="50" type="password"/>
        <br />
        <input type="submit" value="Login"/>
        </form>  
    </body>  
</html>
取消 提交回答
全部回答(1)
  • a123456678
    2019-07-17 19:05:21

    那个是默认的url,formauthenticationfilter里没记错的话,你的

    0 0
相关问答

17

回答

【大咖问答】对话PostgreSQL 中国社区发起人之一,阿里云数据库高级专家 德哥

阿里ACE 彭飞 2019-07-10 09:36:10 971088浏览量 回答数 17

162

回答

惊喜翻倍:免费ECS+免费环境配置~!(ECS免费体验6个月活动3月31日结束)

豆妹 2014-10-29 17:52:21 223027浏览量 回答数 162

8

回答

OceanBase 使用动画(持续更新)

mq4096 2019-02-20 17:16:36 333891浏览量 回答数 8

110

回答

OSS存储服务-客户端工具

newegg11 2012-05-17 15:37:18 292306浏览量 回答数 110

18

回答

阿里云开放端口权限

xcxx 2016-07-20 15:03:33 643175浏览量 回答数 18

33

回答

Win Server 2003-2016 加密勒索事件必打补丁合集

妙正灰 2017-05-15 10:44:38 277553浏览量 回答数 33

38

回答

安全组详解,新手必看教程

我的中国 2017-11-30 15:23:46 256885浏览量 回答数 38

294

回答

Linux Bash严重漏洞修复紧急通知(已全部给出最终修复方案)

qilu 2014-09-25 13:26:50 431630浏览量 回答数 294

249

回答

阿里云LNAMP(Linux + Nginx + Apache + MySQL + PHP)环境一键安装脚本

云代维 2014-02-14 15:26:06 302619浏览量 回答数 249

24

回答

【精品问答】python技术1000问(1)

问问小秘 2019-11-15 13:25:00 471475浏览量 回答数 24
+关注
0
文章
14879
问答
推荐问答
相关电子书
更多
文娱运维技术
立即下载
《SaaS模式云原生数据仓库应用场景实践》
立即下载
《看见新力量:二》电子书
立即下载