我对Spring和Spring安全性比较陌生.
我试图编写一个程序,我需要使用Spring安全性在服务器端验证用户,
我想出了以下内容:
public class CustomAuthenticationProvider extends AbstractUserDetailsAuthenticationProvider{
@Override
protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken)
throws AuthenticationException
{
System.out.println("Method invoked : additionalAuthenticationChecks isAuthenticated ? :"+usernamePasswordAuthenticationToken.isAuthenticated());
}
@Override
protected UserDetails retrieveUser(String username,UsernamePasswordAuthenticationToken authentication) throws AuthenticationException
{
System.out.println("Method invoked : retrieveUser");
//so far so good, i can authenticate user here, and throw exception if not authenticated!!
//THIS IS WHERE I WANT TO ACCESS SESSION OBJECT
}
}
Run Code Online (Sandbox Code Playgroud)
我的用例是,当用户通过身份验证时,我需要放置一个属性,如:
session.setAttribute("userObject", myUserObject);
Run Code Online (Sandbox Code Playgroud)
myUserObject是某个类的对象,我可以跨多个用户请求访问整个服务器代码.
我试图在图像资源中使用平铺图像,我正在参考GWT教程...
一节说你需要使用精灵:http: //code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html#ImageResource
repeatStyle是一个枚举值,与@sprite指令结合使用,表示图像是要平铺的
所以,现在我需要添加一个精灵指令..在哪里?关于精灵的研究,我来到这里:http: //code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html#Image_Sprites
该示例指示创建两个文件:
我会在哪里写这个:
@sprite .mySpriteClass {gwt-image:"imageAccessor"; 其他:财产;}
?
更多参考报价供参考:
@sprite对声明CSSResource的FooBundle很敏感; 在@sprite声明中命名的兄弟ImageResource方法将用于组成背景精灵.
我听说java中的instanceof运算符是一个性能问题,
是否也适用于Javascript(IE6,IE7,IE8,FF,Chrome,Safari等)?任何真实文件的链接都会有所帮助.
我们正在将spring security用于我们的系统,而我们的服务器正在使用https方案.
但是,应用程序在http而不是https上运行,因此作为apache的服务器是https处理程序.而应用程序在防火墙后面的http上运行.
工作代码:
<form-login login-page="/Login.html"
authentication-failure-url="https://www.ourapp.com/FailureLogin.jsp"
always-use-default-target="false"
default-target-url="https://www.ourapp.com/SuccessLogin.jsp"/>
<form-login login-page="/Login.html"
authentication-failure-url="https://www.ourapp.com/FailureLogin.jsp"
always-use-default-target="false"
default-target-url="https://www.ourapp.com/SuccessLogin.jsp"/>
Run Code Online (Sandbox Code Playgroud)
不工作的代码:
<form-login login-page="/Login.html"
authentication-failure-url="/FailureLogin.jsp"
always-use-default-target="false"
default-target-url="/SuccessLogin.jsp"/>
<form-login login-page="/Login.html"
authentication-failure-url="/FailureLogin.jsp"
always-use-default-target="false"
default-target-url="/SuccessLogin.jsp"/>
Run Code Online (Sandbox Code Playgroud)
有什么方法可以提及:重定向到以/SuccessLogin.jsp结尾但使用https协议的Url?
作为参考,问题是交叉发布@ Code ranch PS:我可以在TargetUrlResolver帮我配置吗?
我正在努力在IMAP中创建一个文件夹(我正在使用gmail)
这是我到目前为止所尝试的:
public boolean createFolder(String folderName) throws MessagingException
{
store = session.getStore("imap");
System.out.println("connecting store..");
store.connect("imap.gmail.com", 993, "something@gmail.com", "password");
System.out.println("connected !");
//using store.getDefaultFolder(); shows error : "folder cannot contain messages"
Folder defaultFolder = store.getFolder("Inbox");
return createFolder(defaultFolder, folderName);
}
private boolean createFolder(Folder parent, String folderName)
{
boolean isCreated = true;
try
{
parent.open(Folder.READ_WRITE);
System.out.println("adding listeners...");
parent.addFolderListener(myMailFolderListener);
System.out.println("creating a folder ....");
Folder testFolder = parent.getFolder(folderName);
isCreated = testFolder.create(Folder.HOLDS_MESSAGES);
System.out.println("created: " + isCreated);
parent.close(true);
} catch (Exception e)
{
System.out.println("Error creating folder: " + …
Run Code Online (Sandbox Code Playgroud) 我正在使用java邮件在IMAP客户端上工作.我们目前要求创建"按对话分组"功能,用户可以将邮件视为对话(请参阅回复和转发的gmail群组邮件)
我能够从服务器检索邮件,但在我收到的邮件中,回复的邮件与实际邮件"融合",并被视为实际邮件内容.
例如:初始邮件:
<div>This is the initial mail.</div>
Run Code Online (Sandbox Code Playgroud)
回复邮件:
This is the response Mail<br><br>
<div class="gmail_quote">
On Wed, Aug 26, 2009 at 4:26 PM, [censored]
<span dir="ltr"><
<a href="mailto:[censored]@[censored].com">
[censored]@[censored].com
</a>
>
</span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>This is the initial mail.</div>
<div></div>
</blockquote>
</div>
<br>
Run Code Online (Sandbox Code Playgroud)
如上所示,没有迹象表明什么是实际的和什么是回复的邮件,那么如何提供像gmail一样的分组(无论从哪里读取邮件的服务器)?
我是春天和春天安全的新手,
我已经理解了如何在xml文件中创建和引用bean,我需要使用spring为我的应用程序提供安全性.
我在web.xml中包含了一个自定义applicationContext-security.xml文件:contextConfigLocation
在这个文件中,我使用截取了url模式
<intercept-url pattern='/**.something' access="IS_AUTHENTICATED_FULLY"/>
Run Code Online (Sandbox Code Playgroud)
内部元素.
我现在已经设置了登录表单,如果页面未经授权,则会显示我的自定义Login.html页面.
现在我面临的问题是:
我试过这个:
<authentication-provider user-service-ref="userDetailsService"/>
<beans:bean id = "userDetailsService" class ="com.somepath.CustomAuthenticationProvider">
<custom-authentication-provider/>
</beans:bean>
Run Code Online (Sandbox Code Playgroud)
其中CustomAuthenticationProvider实现AuthenticationProvider
但代码抛出一个错误:创建名为'_filterChainProxy'的bean时出错....没有UserDetailsService注册
请帮忙
我的要求是提供:
在同一个项目中.
我试图将Spring安全性插入到现有项目中(为简单起见,代码被剥离):
<?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-2.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-2.0.1.xsd">
<http auto-config="false">
<remember-me user-service-ref="rememberMeUserService" key="some custom key" /> <!-- TODO: Key made for testing reasons.... -->
<intercept-url pattern='/mainApplication/Main screen.html' access="ROLE_ADMIN"/>
<intercept-url pattern='/**' filters="none"/> <!-- Allow entry to login screen -->
<openid-login authentication-failure-url="/Login.html?error=true" default-target-url="/mainApplication/Main screen.html" user-service-ref="openIdUserService"/>
<form-login login-page="/Login.html" authentication-failure-url="/Login.html?error=true" always-use-default-target="true" default-target-url="/mainApplication/Main screen.html"/>
</http>
<beans:bean id="rememberMeUserService" class="mypackage.CustomUserService">
<beans:property name="usersService" ref="usersService"></beans:property>
</beans:bean>
<!-- Common login shared entry-point for both Form and OpenID based logins …
Run Code Online (Sandbox Code Playgroud) java ×4
email ×2
gmail ×2
gwt ×2
imap ×2
spring ×2
browser ×1
css ×1
https ×1
image ×1
javascript ×1
message ×1
optimization ×1
performance ×1
security ×1
spring-mvc ×1
tile ×1