Java、Spring 3.2.x、および休止状態を使用して開発された Web アプリケーションがあります。
Web アプリをサーバーとして作成することにより、RestFul サービスを実装します (アプリは webapp と残りのサーバーの両方です)。
http リクエストを使用してサーバーからデータを取得するときはいつでも、webapp にログインする必要がありますか? それが今の私の課題です。ログインするまで詳細を取得できません。このログインをバイパスする必要がある方法。助言がありますか!前もって感謝します!詳細が必要な場合はお知らせください。
web.xml のサーブレット部分
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
webapp のセキュリティには、Spring Security を使用します。
以下は私のsecurity.xmlファイルです
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:security="http://www.springframework.org/schema/security"
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-3.1.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<import resource="classpath:spring-authentication.xml"/>
<security:http pattern="/" security="none"/>
<security:http pattern="/login.*" security="none"/>
<security:http pattern="/forgotpassword.*" security="none"/>
<security:http pattern="/img/**" security="none"/>
<security:http pattern="/css/**" security="none"/>
<security:http pattern="/ws/**" security="none"/>
<security:http realm="myrealm">
<security:intercept-url pattern="/*jsp" access="ROLE_ADMIN"/>
<!-- order matters so these overrides must be above the star do below to work -->
<security:intercept-url pattern="/welcome.do" access="ROLE_ADMIN"/>
<security:intercept-url pattern="/MyProfile.do" access="ROLE_ADMIN"/>
<security:intercept-url pattern="/User.do" access="ROLE_ADMIN"/>
<security:intercept-url pattern="/UserSearch.do" access="ROLE_ADMIN"/>
<security:intercept-url pattern="/UserList.do" access="ROLE_ADMIN"/>
<security:intercept-url pattern="/PasswordReset.do" access="ROLE_ADMIN"/>
<security:intercept-url pattern="/*do" access="ROLE_ADMIN"/>
<security:intercept-url pattern="/*csv" access="ROLE_ADMIN"/>
<security:intercept-url pattern="/*pdf" access="ROLE_ADMIN"/>
<security:intercept-url pattern="/ui/**" access="ROLE_ADMIN" />
<security:intercept-url pattern="/admin/**" access="ROLE_ADMIN" />
<!-- Catch all to prevent public access to anything missed by proceeding filters -->
<security:intercept-url pattern="/**" access="ROLE_ADMIN" />
<security:form-login login-page="/login.do"
default-target-url="/welcome.do"
always-use-default-target="true"
authentication-failure-url="/login.do?login_error=1"
/>
<security:logout logout-success-url="/login.do" />
<security:http-basic/>
<security:anonymous />
</security:http>
<bean id="authProvider" class="security.AuthenticationProvider">
</bean>
<security:authentication-manager alias="authenticationManager">
<security:authentication-provider ref="authProvider"/>
</security:authentication-manager>
</beans>