我正在使用Spring 3和spring security.我正在整合社交帐户,例如:Facebook,Twitter和Google.我正在使用javascript sdk版本,但我的问题是我可以注册用户,但我不知道如何验证它们.
例如:
当用户点击任何链接(Facebook,Twitter,谷歌)后,在成功通过身份验证后打开新对话框我可以获得他们的基本个人资料详细信息:电子邮件,身份证,姓名,图像,我使用ajax将所有这些信息传递给我的控制器如果用户尚未注册,则调用service和dao来保存用户.
直到这里一切都对我很好.我使用用户ID并使用salt加密它们并将其作为密码保存到数据库中(我不确定这是否是正确的处理方式)但现在我的困惑是如何验证用户并允许它们登录系统.
我的security.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans" xmlns="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.2.xsd">
<!-- Configuration for master level user login -->
<http auto-config="true" use-expressions="true"
disable-url-rewriting="true">
<!-- <csrf /> -->
<headers>
<cache-control />
<content-type-options />
<hsts />
<frame-options />
<xss-protection />
</headers>
<!-- requires-channel="https" -->
<intercept-url pattern="/favicon.ico" access="permitAll" />
<intercept-url pattern="/login*" access="permitAll" />
<intercept-url pattern="/login/facebook-login*" access="permitAll" />
<intercept-url pattern="/validateUserCredentials*"
access="permitAll" />
<intercept-url pattern="/register*" access="permitAll" />
<intercept-url pattern="/activation*" access="permitAll" />
<intercept-url pattern="/restore*" access="permitAll" />
<intercept-url pattern="/resend*" …Run Code Online (Sandbox Code Playgroud) 我有像这样的ajax json POST方法
$.ajax({
type: 'POST',
url: "localhost:8080/webeditor/spring/json/",
data: JSON.stringify(contents),
dataType: "json"
});
Run Code Online (Sandbox Code Playgroud)
控制器处理发布请求
JSONPObject json;
BindingResult result = new BeanPropertyBindingResult( json , "MyPresentation" );
@RequestMapping(value="json/", method = RequestMethod.POST)
public void savePresentationInJSON(Presentations presentation,BindingResult result) {
//do some action
}
Run Code Online (Sandbox Code Playgroud)
但是我收到了这个错误
XMLHttpRequest无法加载localhost:8080/webeditor/spring/json /.仅支持HTTP的跨源请求.
我不确定如何纠正上述错误.
我想pdf在电子邮件中附加一个文件,我尝试使用此代码发送包含pdf文件的电子邮件.
String to = textTo.getText().toString();
String subject = textSubject.getText().toString();
String message = textMessage.getText().toString();
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{ to});
email.putExtra(Intent.EXTRA_SUBJECT, subject);
email.putExtra(Intent.EXTRA_TEXT, message);
email.setType("message/rfc822");
startActivity(Intent.createChooser(email, "Choose an Email client :"));
Run Code Online (Sandbox Code Playgroud) 嗨,我有一个亚马逊ec2服务器,我正在使用这个服务器用于我的Java应用程序,但从最近几天我面临一个非常不寻常的问题,我担心有些人可能会玩我的服务器.
当我使用ipaddress:8080/manager登录我的tomcat管理器时.它让我输入我在tomcat-user.xml文件中的用户名和密码.当我登录系统时,它在几分钟后只显示一个活动实例,它向我显示有多个用户使用tomcat管理器,但问题是我没有与任何人共享我的凭据.请检查此屏幕截图.
正如您所看到的,我的tomcat管理器有94个会话ID可用,但它们都没有用户名,它们也没有活动状态.只有一个是活动的,我使用用户名admin登录.
当我检查服务器日志时,我还发现有些人正在尝试使用以下角色root-tomcat-manager进行身份验证.附上日志.
Sep 28, 2015 4:54:02 PM org.apache.catalina.realm.LockOutRealm authenticate
WARNING: An attempt was made to authenticate the locked user "root"
Sep 28, 2015 4:55:07 PM org.apache.catalina.realm.LockOutRealm authenticate
WARNING: An attempt was made to authenticate the locked user "admin"
Sep 28, 2015 4:56:44 PM org.apache.catalina.realm.LockOutRealm authenticate
WARNING: An attempt was made to authenticate the locked user "manager"
Sep 29, 2015 7:08:16 AM org.apache.catalina.realm.LockOutRealm authenticate
WARNING: An attempt was made to authenticate the locked user "root" …Run Code Online (Sandbox Code Playgroud) 我正在开发一个跟踪一系列任务的内部应用程序.我想要一个简单的任务监视器,列出任务名称和任务的状态.我需要这个看起来有点好看,我不是设计师,所以无论我做什么都会吮吸,但基本的文本显示不适用于项目要求.
我基本上试图做的是显示类似于Firefox下载窗口,I-Tunes下载窗口的东西,我可以更多地命名,但它们看起来基本相同.在每个应用程序中,每个"进度面板"都是可选的.因此,为了实现这一点,我认为只使用一个JPanels列表就很简单,每个JPanels都有一个JProgressBar和一个JLabel,每个JPanel都可以接受焦点来确定是否选择了它.我认为这将是一项简单的任务,但如果我使用JList它只显示文本.然后我想我会在一个更大的面板中显示所有任务面板,但我无法让内部面板识别焦点.
有这种模式吗?是否有我刚刚找不到的滚动标准解决方案?或者有更好的方法吗?我不想重新发明轮子,但我认为这只是简单.
每当我按Tab键时,我希望我的JTextPane插入空格.目前它插入制表符(ASCII 9).
反正是有自定义JTextPane的选项卡策略(除了捕获"tab-key"事件和插入空格本身似乎)?
我的要求是每5秒自动刷新一次DIV
我要刷新的DIV内容是
<div class="row-fluid">
<div class ="span2">
<label><spring:message code='total.registration' />:</label>
</div>
<div class = "span3">
${registrationStatusForm.totalRegis}
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我还检查了一些关于stackoverflow的问题但是不明白.请注意我正在使用Spring Web MVC.请建议.
我正在尝试使用Java中的Selenium脚本保存HTML页面,该脚本执行以下操作
现在的问题是,当脚本单击“另存为html”选项时,它会显示一个弹出窗口以保存html。
我已经设置了在Firefox中下载的默认选项,但是当我运行脚本时,它会不断显示我弹出窗口,我需要的是:-
我正在研究一个Java swing应用程序,我正在尝试在用户进行任何更改时更新PostgreSQL数据库.
表中有四个字段,如果我尝试一次更新一列它工作正常但是当我使用时AND它显示以下错误消息给我
捕获异常: - org.postgresql.util.PSQLException:错误:AND的参数必须是boolean类型,而不是类型字符变化
下面给出的是我用来更新表的代码.
Connection con = DbConnection.getConnect();
Statement stmt = con.createStatement();
String sql = "UPDATE webservice_config set product = ? AND product_cat = ? AND stock = ? where ID=?;";
PreparedStatement pstInsert = con.prepareStatement(sql);
pstInsert.setString(1, product);
pstInsert.setString(2, productCat);
pstInsert.setString(3, stock);
pstInsert.setString(4, "1");
pstInsert.executeUpdate();
con.close();
Run Code Online (Sandbox Code Playgroud)
任何帮助
我想要做的是在进程发生时显示带有进度条的新面板.
我的代码如下:
case "GoButton":
cards.show(this, "pp");
this.test();
cards.show(this, "panel1");
break;
Run Code Online (Sandbox Code Playgroud)
这是一种actionPerformed方法
但是当我运行程序时它只是忽略第一个cards.show,它执行test代码然后执行第二个cards.show
如果您需要,我还会为您提供其余的代码
public CreatePanel(JFrame frame) {
ext = new ArrayList<>();
files = new ArrayList<>();
this.mainWindow = frame;
this.setSize(256, 256);
cards = new CardLayout();
this.setLayout(cards);
panel1 = new JPanel(null);
createPanel1(panel1);
this.add(panel1, "panel1");
panel2 = new JPanel(null);
createPanel2(panel2);
this.add(panel2, "panel2");
panel3 = new JPanel(null);
createPanel3(panel3);
this.add(panel3, "pp");
cards.show(this, "panel1");
}
public class ProgressPanel {
private static JPanel panel;
private static JProgressBar progressBar;
private static …Run Code Online (Sandbox Code Playgroud) java ×8
swing ×3
ajax ×2
jpanel ×2
spring ×2
spring-mvc ×2
amazon-ec2 ×1
android ×1
automation ×1
email ×1
facebook ×1
javascript ×1
jdbc ×1
jlist ×1
jquery ×1
jtextpane ×1
pdf ×1
postgresql ×1
selenium ×1
sql-update ×1
sqlexception ×1
tomcat ×1
tomcat7 ×1
webdriver ×1