SEC-1536: added JAAS API Integration, updated doc, updated jaas sample
This commit is contained in:
@@ -13,7 +13,6 @@ dependencies {
|
||||
|
||||
runtime project(':spring-security-web'),
|
||||
project(':spring-security-config'),
|
||||
project(':spring-security-taglibs'),
|
||||
"org.springframework:spring-context-support:$springVersion",
|
||||
"javax.servlet:jstl:$jstlVersion",
|
||||
"org.slf4j:jcl-over-slf4j:$slf4jVersion",
|
||||
|
||||
@@ -67,7 +67,7 @@ public class UsernameEqualsPasswordLoginModule implements LoginModule {
|
||||
}
|
||||
|
||||
public boolean login() throws LoginException {
|
||||
if (username != null && !username.equals(password)) {
|
||||
if (username == null || !username.equals(password)) {
|
||||
throw new LoginException("username is not equal to password");
|
||||
}
|
||||
|
||||
@@ -75,6 +75,9 @@ public class UsernameEqualsPasswordLoginModule implements LoginModule {
|
||||
public String getName() {
|
||||
return username;
|
||||
}
|
||||
public String toString() {
|
||||
return "Principal [name="+getName()+"]";
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
|
||||
|
||||
|
||||
<sec:http auto-config="true" use-expressions="true">
|
||||
<sec:http auto-config="true" use-expressions="true" jaas-api-provision="true">
|
||||
<sec:intercept-url pattern="/secure/**" access="isAuthenticated()"/>
|
||||
</sec:http>
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
<%@ page import="javax.security.auth.Subject" %>
|
||||
<%@ page import="java.security.AccessController" %>
|
||||
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
|
||||
<html>
|
||||
<body>
|
||||
@@ -9,6 +11,9 @@ Anyone can view this page.
|
||||
Your principal object is....: <%= request.getUserPrincipal() %>
|
||||
</p>
|
||||
<p>
|
||||
Subject.getSubject(AccessController.getContext()) is....: <%= Subject.getSubject(AccessController.getContext()) %>
|
||||
</p>
|
||||
<p>
|
||||
<sec:authorize url='/secure/index.jsp'>You can currently access "/secure" URLs.</sec:authorize>
|
||||
</p>
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
<%@ page import="javax.security.auth.Subject" %>
|
||||
<%@ page import="java.security.AccessController" %>
|
||||
<%@ page import="org.springframework.security.core.context.SecurityContextHolder" %>
|
||||
<%@ page import="org.springframework.security.core.Authentication" %>
|
||||
<%@ page import="org.springframework.security.core.GrantedAuthority" %>
|
||||
@@ -10,6 +12,15 @@
|
||||
|
||||
<h3>Security Debug Information</h3>
|
||||
|
||||
<%
|
||||
|
||||
Subject subject = Subject.getSubject(AccessController.getContext());
|
||||
if(subject != null) { %>
|
||||
<p>
|
||||
Subject.getSubject(AccessController.getContext()) is....: <%= subject %>
|
||||
</p>
|
||||
<%} %>
|
||||
|
||||
<%
|
||||
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (auth != null) { %>
|
||||
|
||||
Reference in New Issue
Block a user