- Migrate to Spring 3.1

- Remove Acegy
- Fix editor partially
This commit is contained in:
Paulo Gustavo Veiga 2012-02-12 02:55:42 -03:00
parent 2287825292
commit 5fd6ba30f5
36 changed files with 2154 additions and 2402 deletions

View File

@ -1,53 +0,0 @@
h1. Documentation
h2. Architecture
WiseMapping has been development mainly in Java and JavaScript. The following diagram represents a high level overview of the product
[[http://www.wisemapping.org/_/rsrc/1257718018304/documentation/architecture/Wise%20Editor%20Architecture.png]]
h2. Configuration
h3. DataBase
Wisemapping support a wide variety of databases, but we provide the Databases script initialization for HSQL and MySQL Database. The initialization script are located within <WISEMAPPING_SOURCE_DIR>\trunk\wise-webapp\src\test\sql.
This directory contains the following 3 scripts::
create-schemas.sql: Contains all the SQL statement to create the Wisemappings tables.
drop-schemas.sql:Contains all the SQL statement to drop all the Wisemapping database.
test-data.sql: This script creates a sample data and the test user called test@wisemapping.com and password test.
MySQL
h4. Create Database User
Using the MySQL Databse Tools run the following command in order to create the database user.
CREATE DATABASE wisemapping CHARACTER SET='utf8' COLLATE='utf8_unicode_ci';
CREATE USER 'wisemapping'@'localhost' IDENTIFIED BY 'd0ndu3nd3';
GRANT ALL ON wisemapping.* TO 'wisemapping'@'localhost';
h3. Configuration
You can configure Wisemapping through the following file:
wise-webapp\src\main\webapp\WEB-INF\app.properties.
This property file contains all the properties to configure the database, mail and other resources used by Wisemapping.
Property -> Description
* database.url -> The Database URL(Ex. dbc:hsqldb:file:target/db/wisemapping)
* database.driver-> The Database Driver.(Ex. org.hsqldb.jdbcDriver)
* database.hibernate.dialect -> The Database dialect. This value is used by Spring DB.(Ex. org.hibernate.dialect.HSQLDialect)
* database.username -> The database username
* database.password -> The database password
* mail.smtp.socketFactory.port -> The mail port to send email
* mail.host -> The email server host
* mail.user -> The mail username
* mail.password -> The mail password
* mail.registrationEmail -> The email used as FROM in the registration emails.
* mail.siteEmail -> The email used as FROM in the notification emails.
h3. Logging Properties
WiseMapping uses Log4J to log all the events. The configuration file is located in :
<WISEMAPPING_DIR>\wise-webapp\src\main\webapp\WEB-INF\classes

View File

@ -16,7 +16,7 @@
<dependency> <dependency>
<groupId>org.wisemapping</groupId> <groupId>org.wisemapping</groupId>
<artifactId>web2d</artifactId> <artifactId>web2d</artifactId>
<version>3.0-SNAPSHOT</version> <version>${com.wisemapping.version}</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<!-- <dependency> <!-- <dependency>

View File

@ -2,6 +2,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"> http://maven.apache.org/xsd/maven-4.0.0.xsd">
<properties>
<com.wisemapping.version>3.0-SNAPSHOT</com.wisemapping.version>
</properties>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wisemapping</groupId> <groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId> <artifactId>wisemapping</artifactId>
@ -83,5 +88,7 @@
<module>wise-webapp</module> <module>wise-webapp</module>
<module>wise-editor</module> <module>wise-editor</module>
</modules> </modules>
</project> </project>

View File

@ -16,13 +16,13 @@
<dependency> <dependency>
<groupId>org.wisemapping</groupId> <groupId>org.wisemapping</groupId>
<artifactId>core-js</artifactId> <artifactId>core-js</artifactId>
<version>3.0-SNAPSHOT</version> <version>${com.wisemapping.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wisemapping</groupId> <groupId>org.wisemapping</groupId>
<artifactId>mindplot</artifactId> <artifactId>mindplot</artifactId>
<version>3.0-SNAPSHOT</version> <version>${com.wisemapping.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@ -40,7 +40,7 @@
<maxIdleTime>60000</maxIdleTime> <maxIdleTime>60000</maxIdleTime>
</connector> </connector>
</connectors> </connectors>
<webApp>${project.build.directory}/wise-editor-3.0-SNAPSHOT.war</webApp> <webApp>${project.build.directory}/wise-editor-${com.wisemapping.version}.war</webApp>
</configuration> </configuration>
</plugin> </plugin>

View File

@ -27,24 +27,29 @@
</repository> </repository>
</repositories> </repositories>
<properties>
<org.springframework.version>3.1.0.RELEASE</org.springframework.version>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.wisemapping</groupId> <groupId>org.wisemapping</groupId>
<artifactId>core-js</artifactId> <artifactId>core-js</artifactId>
<version>3.0-SNAPSHOT</version> <version>${com.wisemapping.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wisemapping</groupId> <groupId>org.wisemapping</groupId>
<artifactId>wise-editor</artifactId> <artifactId>wise-editor</artifactId>
<version>3.0-SNAPSHOT</version> <version>${com.wisemapping.version}</version>
<scope>provided</scope> <scope>provided</scope>
<type>war</type> <type>war</type>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wisemapping</groupId> <groupId>org.wisemapping</groupId>
<artifactId>mindplot</artifactId> <artifactId>mindplot</artifactId>
<version>3.0-SNAPSHOT</version> <version>${com.wisemapping.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -69,13 +74,35 @@
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId> <artifactId>spring-webmvc</artifactId>
<version>2.5.6</version> <version>${org.springframework.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-webmvc-struts</artifactId> <artifactId>spring-web</artifactId>
<version>2.5.6</version> <version>${org.springframework.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-struts</artifactId>
<version>${org.springframework.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<version>2.7.6</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -83,17 +110,35 @@
<artifactId>struts-tiles</artifactId> <artifactId>struts-tiles</artifactId>
<version>1.3.8</version> <version>1.3.8</version>
<scope>runtime</scope> <scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId> <artifactId>spring-aop</artifactId>
<version>2.5.6</version> <version>${org.springframework.version}</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId> <artifactId>spring-orm</artifactId>
<version>2.5.6</version> <version>${org.springframework.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${org.springframework.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${org.springframework.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -111,25 +156,13 @@
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId> <artifactId>spring-jdbc</artifactId>
<version>2.5.6</version> <version>${org.springframework.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-support</artifactId>
<version>1.5.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core-tiger</artifactId>
<version>1.5.6</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId> <artifactId>hibernate-entitymanager</artifactId>
<version>3.1.3</version> <version>3.6.0.Final</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -168,46 +201,6 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.acegisecurity</groupId>
<artifactId>acegi-security</artifactId>
<version>1.0.7</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-dao</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-support</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-remoting</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId> <artifactId>servlet-api</artifactId>
@ -352,13 +345,15 @@
<groupId>org.wisemapping</groupId> <groupId>org.wisemapping</groupId>
<artifactId>wise-editor</artifactId> <artifactId>wise-editor</artifactId>
<type>war</type> <type>war</type>
<targetPath>css</targetPath> <targetPath>/</targetPath>
<includes> <includes>
<include>**/*.css</include> <include>**/*.css</include>
<include>**/*.jpg</include> <include>**/*.png</include>
<include>**/*.gif</include>
<include>**/*.ico</include> <include>**/*.ico</include>
<include>**/*.jpg</include> <include>**/*.jpg</include>
<include>**/*.less</include> <include>**/*.less</include>
<include>js/editor.js</include>
</includes> </includes>
</overlay> </overlay>
<overlay> <overlay>
@ -404,37 +399,6 @@
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>net.sf.alchim</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>0.7.1</version>
<executions>
<execution>
<id>wiseEditorLibrary</id>
<phase>generate-resources</phase>
<goals>
<goal>compress</goal>
</goals>
<configuration>
<aggregations>
<aggregation>
<output>
${project.build.directory}/${project.build.finalName}/js/editorLib.js
</output>
<includes>
<include>help.js</include>
<include>Panel.js</include>
</includes>
</aggregation>
</aggregations>
<nosuffix>true</nosuffix>
<nomunge>true</nomunge>
<jswarn>false</jswarn>
<statistics>false</statistics>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
@ -450,17 +414,10 @@
<plugin> <plugin>
<groupId>org.mortbay.jetty</groupId> <groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId> <artifactId>jetty-maven-plugin</artifactId>
<version>6.1.26</version> <version>8.1.0.v20120127</version>
<configuration> <configuration>
<scanIntervalSeconds>10</scanIntervalSeconds> <war>${project.build.directory}/wisemapping.war</war>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8080</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<webApp>${project.build.directory}/wisemapping.war</webApp>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@ -23,7 +23,7 @@ import com.wisemapping.model.MindmapUser;
import com.wisemapping.model.User; import com.wisemapping.model.User;
import com.wisemapping.model.UserLogin; import com.wisemapping.model.UserLogin;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.acegisecurity.providers.encoding.PasswordEncoder; //import org.acegisecurity.providers.encoding.PasswordEncoder;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -32,12 +32,12 @@ public class UserManagerImpl
extends HibernateDaoSupport extends HibernateDaoSupport
implements UserManager { implements UserManager {
private PasswordEncoder passwordEncoder; // private PasswordEncoder passwordEncoder;
//
public void setPasswordEncoder(PasswordEncoder passwordEncoder) // public void setEncoder(PasswordEncoder passwordEncoder)
{ // {
this.passwordEncoder = passwordEncoder; // this.passwordEncoder = passwordEncoder;
} // }
public List<User> getAllUsers() { public List<User> getAllUsers() {
return getHibernateTemplate().find("from com.wisemapping.model.User user"); return getHibernateTemplate().find("from com.wisemapping.model.User user");
@ -93,13 +93,13 @@ public class UserManagerImpl
public void createUser(User user) { public void createUser(User user) {
assert user != null : "Trying to store a null user"; assert user != null : "Trying to store a null user";
user.setPassword(passwordEncoder.encodePassword(user.getPassword(),null)); // user.setPassword(passwordEncoder.encodePassword(user.getPassword(),null));
getHibernateTemplate().saveOrUpdate(user); getHibernateTemplate().saveOrUpdate(user);
} }
public User createUser(User user, Colaborator col) public User createUser(User user, Colaborator col)
{ {
user.setPassword(passwordEncoder.encodePassword(user.getPassword(),null)); // user.setPassword(passwordEncoder.encodePassword(user.getPassword(),null));
assert user != null : "Trying to store a null user"; assert user != null : "Trying to store a null user";
final Set<MindmapUser> set = col.getMindmapUsers(); final Set<MindmapUser> set = col.getMindmapUsers();
@ -124,7 +124,7 @@ public class UserManagerImpl
public void updateUser(User user) { public void updateUser(User user) {
assert user != null : "user is null"; assert user != null : "user is null";
user.setPassword(passwordEncoder.encodePassword(user.getPassword(),null)); // user.setPassword(passwordEncoder.encodePassword(user.getPassword(),null));
getHibernateTemplate().update(user); getHibernateTemplate().update(user);
} }

View File

@ -18,9 +18,11 @@
package com.wisemapping.model; package com.wisemapping.model;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable; import java.io.Serializable;
import java.util.*; import java.util.*;
@XmlRootElement(name="user")
public class User public class User
extends Colaborator extends Colaborator
implements Serializable implements Serializable

View File

@ -0,0 +1,30 @@
package com.wisemapping.rest;
import com.wisemapping.model.User;
import org.jetbrains.annotations.NotNull;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class UserController {
private Jaxb2Marshaller jaxb2Mashaller;
public void setJaxb2Mashaller(@NotNull final Jaxb2Marshaller jaxb2Mashaller) {
this.jaxb2Mashaller = jaxb2Mashaller;
}
private static final String XML_VIEW_NAME = "users";
@RequestMapping(method = RequestMethod.GET, value = "/employee/{id}")
public ModelAndView getEmployee(@PathVariable String id) {
User user = new User();
return new ModelAndView(XML_VIEW_NAME, "object", user);
}
}

View File

@ -1,30 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.security;
import org.acegisecurity.AuthenticationException;
import javax.servlet.http.HttpServletRequest;
public interface AuthenticationHandler
{
AuthenticationToken getAuthenticationToken(HttpServletRequest request) throws AuthenticationException;
}

View File

@ -0,0 +1,48 @@
package com.wisemapping.security;
import com.wisemapping.dao.UserManager;
import com.wisemapping.model.User;
import org.jetbrains.annotations.NotNull;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.encoding.PasswordEncoder;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
public class AuthenticationProvider implements org.springframework.security.authentication.AuthenticationProvider {
private UserManager userManager;
private PasswordEncoder encoder;
@Override
public Authentication authenticate(@NotNull final Authentication auth) throws AuthenticationException {
// All your user authentication needs
final String email = auth.getName();
final User user = userManager.getUserBy(email);
final String credentials = (String) auth.getCredentials();
if (user == null || credentials == null || !encoder.isPasswordValid(user.getPassword(), credentials, null)) {
throw new BadCredentialsException("Username/Password does not match for " + auth.getPrincipal());
}
final UserDetails userDetails = new UserDetails(user);
return new UsernamePasswordAuthenticationToken(userDetails, credentials, userDetails.getAuthorities());
}
@Override
public boolean supports(final Class<? extends Object> authentication) {
return (UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication));
}
public void setEncoder(@NotNull PasswordEncoder encoder) {
this.encoder = encoder;
}
public void setUserManager(UserManager userManager) {
this.userManager = userManager;
}
}

View File

@ -1,41 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.security;
public class AuthenticationToken
{
private String username;
private String password;
public AuthenticationToken(String username,String password)
{
this.username = username;
this.password = password;
}
public String getUsername()
{
return username;
}
public String getPassword()
{
return password;
}
}

View File

@ -18,21 +18,20 @@
package com.wisemapping.security; package com.wisemapping.security;
import org.acegisecurity.providers.encoding.PasswordEncoder; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
import org.springframework.security.authentication.encoding.PasswordEncoder;
import org.springframework.security.authentication.encoding.ShaPasswordEncoder;
public class CustomPasswordEncoder public class CustomPasswordEncoder
implements PasswordEncoder implements PasswordEncoder
{ {
private PasswordEncoder delegateEncoder; private PasswordEncoder delegateEncoder = new ShaPasswordEncoder();
private static final String ENC_PREFIX = "ENC:"; private static final String ENC_PREFIX = "ENC:";
public void setDelegatedEncoder(PasswordEncoder delegateEncoder) public String encodePassword(@NotNull String rawPass, @Nullable Object salt) throws DataAccessException {
{
this.delegateEncoder = delegateEncoder;
}
public String encodePassword(String rawPass, Object salt) throws DataAccessException {
String password = rawPass; String password = rawPass;
if (!rawPass.startsWith(ENC_PREFIX)) if (!rawPass.startsWith(ENC_PREFIX))
@ -43,7 +42,7 @@ public class CustomPasswordEncoder
return password; return password;
} }
public boolean isPasswordValid(String encPass, String rawPass, Object salt) throws DataAccessException { public boolean isPasswordValid(@NotNull String encPass, @NotNull String rawPass, Object salt) throws DataAccessException {
String pass1 = "" + encPass; String pass1 = "" + encPass;
String pass2 = rawPass; String pass2 = rawPass;
@ -53,7 +52,6 @@ public class CustomPasswordEncoder
pass2 = encodePassword(rawPass, salt); pass2 = encodePassword(rawPass, salt);
} }
return pass1.equals(pass2);
return pass1.equals(pass2);
} }
} }

View File

@ -1,40 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.security;
import org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices;
import org.acegisecurity.Authentication;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class CustomTokenBasedRememberMeServices extends
TokenBasedRememberMeServices {
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
{
if(authentication!=null)
super.logout(request, response, authentication);
else
{
logger.debug("Session Already Expired. Authentication is null");
response.addCookie(makeCancelCookie(request));
}
}
}

View File

@ -19,23 +19,21 @@
package com.wisemapping.security; package com.wisemapping.security;
import com.wisemapping.dao.UserManager; import com.wisemapping.dao.UserManager;
import org.acegisecurity.userdetails.UserDetailsService; import org.jetbrains.annotations.NotNull;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.providers.encoding.PasswordEncoder;
import org.acegisecurity.providers.encoding.Md5PasswordEncoder;
import org.acegisecurity.providers.dao.SaltSource;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
public class DatabaseUserDetailService public class DatabaseUserDetailService
implements UserDetailsService { implements UserDetailsService {
private UserManager userManager; private UserManager userManager;
public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException, DataAccessException { @Override
public UserDetails loadUserByUsername(@NotNull String email) throws UsernameNotFoundException, DataAccessException {
final com.wisemapping.model.User model = userManager.getUserBy(email); final com.wisemapping.model.User model = userManager.getUserBy(email);
if (model != null) { if (model != null) {
return new User(model); return new UserDetails(model);
} else { } else {
throw new UsernameNotFoundException(email); throw new UsernameNotFoundException(email);
} }

View File

@ -1,43 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.security;
import org.acegisecurity.AuthenticationException;
import org.acegisecurity.ui.webapp.AuthenticationProcessingFilter;
import javax.servlet.http.HttpServletRequest;
public class DefaultAuthenticationHandler
implements AuthenticationHandler
{
public AuthenticationToken getAuthenticationToken(HttpServletRequest request)
throws AuthenticationException
{
String username = request.getParameter(AuthenticationProcessingFilter.ACEGI_SECURITY_FORM_USERNAME_KEY);
String password = request.getParameter(AuthenticationProcessingFilter.ACEGI_SECURITY_FORM_PASSWORD_KEY);
if (username == null) {
username = "";
}
if (password == null) {
password = "";
}
return new AuthenticationToken(username,password);
}
}

View File

@ -1,67 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.security;
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl;
public class User implements UserDetails {
private com.wisemapping.model.User model;
public User(com.wisemapping.model.User model) {
this.model = model;
}
public GrantedAuthority[] getAuthorities() {
return new GrantedAuthority[]{new GrantedAuthorityImpl("ROLE_USER")};
}
public String getPassword() {
return model.getPassword();
}
public String getUsername() {
return model.getEmail();
}
public boolean isAccountNonExpired() {
return true;
}
public boolean isAccountNonLocked() {
return this.model.isActive();
}
public boolean isCredentialsNonExpired() {
return true;
}
public boolean isEnabled() {
return this.model.isActive();
}
public com.wisemapping.model.User getModel() {
return model;
}
public String getDisplayName() {
return model.getFirstname();
}
}

View File

@ -0,0 +1,77 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.security;
import com.wisemapping.model.User;
import org.jetbrains.annotations.NotNull;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import java.util.ArrayList;
import java.util.Collection;
public class UserDetails implements org.springframework.security.core.userdetails.UserDetails {
private com.wisemapping.model.User user;
public UserDetails(@NotNull final com.wisemapping.model.User user) {
this.user = user;
}
public Collection<? extends GrantedAuthority> getAuthorities() {
final SimpleGrantedAuthority role_user = new SimpleGrantedAuthority("ROLE_USER");
final Collection<GrantedAuthority> result = new ArrayList<GrantedAuthority>();
result.add(role_user);
return result;
}
@Override
public String getPassword() {
return user.getPassword();
}
@Override
public String getUsername() {
return user.getEmail();
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return this.user.isActive();
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return this.user.isActive();
}
public User getUser() {
return user;
}
}

View File

@ -19,40 +19,38 @@
package com.wisemapping.security; package com.wisemapping.security;
import com.wisemapping.model.User; import com.wisemapping.model.User;
import org.jetbrains.annotations.NotNull;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.acegisecurity.providers.AbstractAuthenticationToken; final public class Utils {
import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.Authentication;
public class Utils {
private Utils() { private Utils() {
} }
public static User getUser(final HttpServletRequest request) { public static User getUser(@NotNull final HttpServletRequest request) {
final AbstractAuthenticationToken token = (AbstractAuthenticationToken) request.getUserPrincipal(); final AbstractAuthenticationToken token = (AbstractAuthenticationToken) request.getUserPrincipal();
User result = null; User result = null;
if (token != null) { if (token != null) {
final com.wisemapping.security.User user = (com.wisemapping.security.User) token.getPrincipal(); final UserDetails userDetails = (UserDetails) token.getPrincipal();
result = user.getModel(); result = userDetails.getUser();
} }
return result; return result;
} }
public static User getUser() public static User getUser() {
{ User result = null;
User user = null;
final Authentication auth = SecurityContextHolder.getContext().getAuthentication(); final Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (auth != null && auth.getDetails() != null) if (auth != null && auth.getDetails() != null)
{ {
final Object principal = auth.getPrincipal(); final Object principal = auth.getPrincipal();
if (principal != null && principal instanceof com.wisemapping.security.User) { if (principal != null && principal instanceof UserDetails) {
user = ((com.wisemapping.security.User)principal).getModel(); result = ((UserDetails)principal).getUser();
} }
} }
return user; return result;
} }
} }

View File

@ -1,66 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.security;
import org.acegisecurity.Authentication;
import org.acegisecurity.AuthenticationException;
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.acegisecurity.ui.webapp.AuthenticationProcessingFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class WiseAuthenticationProcessingFilter
extends AuthenticationProcessingFilter
{
public static final String ACEGI_SECURITY_FORM_SSO_ID_KEY = "j_sso_id";
private AuthenticationHandler authenticationHandler;
public void setAuthenticationHandler(AuthenticationHandler ssoAuthenticationHandler)
{
this.authenticationHandler = ssoAuthenticationHandler;
}
@Override
public Authentication attemptAuthentication(HttpServletRequest request)
throws AuthenticationException
{
final AuthenticationToken ssoToken = authenticationHandler.getAuthenticationToken(request);
final UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(ssoToken.getUsername(), ssoToken.getPassword());
// Place the last username attempted into HttpSession for views
request.getSession().setAttribute(ACEGI_SECURITY_LAST_USERNAME_KEY, ssoToken.getUsername());
// Allow subclasses to set the "details" property
setDetails(request, authRequest);
return this.getAuthenticationManager().authenticate(authRequest);
}
@Override
protected void onPreAuthentication(HttpServletRequest request, HttpServletResponse response)
throws AuthenticationException, IOException
{
assert request != null;
}
}

View File

@ -0,0 +1,24 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Employees</title>
</head>
<body>
<table border=1>
<thead><tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
</tr></thead>
<%--<c:forEach var="employee" items="${employees.employees}">--%>
<%--<tr>--%>
<%--<td>${employee.id}</td>--%>
<%--<td>${employee.name}</td>--%>
<%--<td>${employee.email}</td>--%>
<%--</tr>--%>
<%--</c:forEach>--%>
</table>
</body>
</html>

View File

@ -13,24 +13,24 @@
<context-param> <context-param>
<param-name>contextConfigLocation</param-name> <param-name>contextConfigLocation</param-name>
<param-value> <param-value>
/WEB-INF/wisemapping-security.xml /WEB-INF/wisemapping-aop.xml
/WEB-INF/wisemapping-dao.xml /WEB-INF/wisemapping-dao.xml
/WEB-INF/wisemapping-service.xml /WEB-INF/wisemapping-service.xml
/WEB-INF/wisemapping-model.xml /WEB-INF/wisemapping-model.xml
/WEB-INF/wisemapping-acegi-security.xml /WEB-INF/wisemapping-security.xml
</param-value> </param-value>
</context-param> </context-param>
<!-- <!--
- Loads the root application context of this web app at startup. - Loads the root application context of this web app at startup.
- The application context is then available via - The application context is then available via
- WebApplicationContextUtils.getWebApplicationContext(servletContext). - WebApplicationContextUtils.getWebApplicationContext(servletContext).
--> -->
<listener> <listener>
<listener-class>com.wisemapping.service.HibernateAppListener</listener-class> <listener-class>com.wisemapping.service.HibernateAppListener</listener-class>
</listener> </listener>
<filter> <filter>
<filter-name>charsetFilter</filter-name> <filter-name>charsetFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
@ -61,16 +61,12 @@
</init-param> </init-param>
</filter> </filter>
<filter> <filter>
<filter-name>Acegi Filter Chain Proxy</filter-name> <filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>org.acegisecurity.util.FilterChainProxy</param-value>
</init-param>
</filter> </filter>
<filter-mapping> <filter-mapping>
<filter-name>Acegi Filter Chain Proxy</filter-name> <filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern> <url-pattern>/*</url-pattern>
</filter-mapping> </filter-mapping>
@ -84,7 +80,7 @@
</listener> </listener>
<servlet> <servlet>
<servlet-name>wisemapping</servlet-name> <servlet-name>mvc-servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup> <load-on-startup>1</load-on-startup>
@ -92,7 +88,20 @@
<param-name>contextConfigLocation</param-name> <param-name>contextConfigLocation</param-name>
<param-value> <param-value>
/WEB-INF/wisemapping-servlet.xml /WEB-INF/wisemapping-servlet.xml
/WEB-INF/wisemapping-captcha.xml </param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>mvc-rest</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/wisemapping-rest.xml
</param-value> </param-value>
</init-param> </init-param>
@ -108,10 +117,15 @@
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>wisemapping</servlet-name> <servlet-name>mvc-servlet</servlet-name>
<url-pattern>*.htm</url-pattern> <url-pattern>*.htm</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet-mapping>
<servlet-name>mvc-rest</servlet-name>
<url-pattern>/service/*</url-pattern>
</servlet-mapping>
<servlet-mapping> <servlet-mapping>
<servlet-name>dwr-invoker</servlet-name> <servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern> <url-pattern>/dwr/*</url-pattern>

View File

@ -15,7 +15,7 @@
<bean id="shaPasswordEncoder" class="org.acegisecurity.providers.encoding.ShaPasswordEncoder"/> <bean id="shaPasswordEncoder" class="org.acegisecurity.providers.encoding.ShaPasswordEncoder"/>
<bean id="passwordEncoder" class="com.wisemapping.security.CustomPasswordEncoder"> <bean id="encoder" class="com.wisemapping.security.CustomPasswordEncoder">
<property name="delegatedEncoder" ref="shaPasswordEncoder"/> <property name="delegatedEncoder" ref="shaPasswordEncoder"/>
</bean> </bean>
@ -154,7 +154,7 @@
<!--</property>--> <!--</property>-->
<!--</bean>--> <!--</bean>-->
<!--</property>--> <!--</property>-->
<property name="passwordEncoder" ref="passwordEncoder"/> <property name="encoder" ref="encoder"/>
</bean> </bean>
<bean id="userDetailsService" class="com.wisemapping.security.DatabaseUserDetailService"> <bean id="userDetailsService" class="com.wisemapping.security.DatabaseUserDetailService">

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="viewSecurityAdvisor"
class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice">
<ref local="viewSecurityAdvice"/>
</property>
<property name="mappedNames">
<list>
<value>getMindmapUserBy</value>
<value>getMindmapById</value>
</list>
</property>
</bean>
<bean id="updateSecurityAdvisor"
class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice">
<ref local="updateSecurityAdvice"/>
</property>
<property name="mappedNames">
<list>
<value>update*</value>
<value>add*</value>
<value>remove*</value>
<value>remove*</value>
</list>
</property>
</bean>
<bean id="updateSecurityAdvice" class="com.wisemapping.security.aop.UpdateSecurityAdvise">
<property name="mindmapService" ref="mindmapService"/>
</bean>
<bean id="viewSecurityAdvice" class="com.wisemapping.security.aop.ViewBaseSecurityAdvise">
<property name="mindmapService" ref="mindmapService"/>
</bean>
</beans>

View File

@ -1,129 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="colorGenRandomDark" class="com.octo.captcha.component.image.color.RandomRangeColorGenerator">
<constructor-arg index="0">
<list>
<value>0</value>
<value>150</value>
</list>
</constructor-arg>
<constructor-arg index="1">
<list>
<value>0</value>
<value>150</value>
</list>
</constructor-arg>
<constructor-arg index="2">
<list>
<value>0</value>
<value>150</value>
</list>
</constructor-arg>
<constructor-arg index="3">
<list>
<value>255</value>
<value>255</value>
</list>
</constructor-arg>
</bean>
<bean id="fontArial" class="java.awt.Font">
<constructor-arg index="0" value="Arial"/>
<constructor-arg index="1" value="0"/>
<constructor-arg index="2" value="10"/>
</bean>
<bean id="fontTahoma" class="java.awt.Font">
<constructor-arg index="0" value="Tahoma"/>
<constructor-arg index="1" value="0"/>
<constructor-arg index="2" value="10"/>
</bean>
<bean id="fontVerdana" class="java.awt.Font">
<constructor-arg index="0" value="Verdana"/>
<constructor-arg index="1" value="0"/>
<constructor-arg index="2" value="10"/>
</bean>
<bean id="fontComic" class="java.awt.Font">
<constructor-arg index="0" value="Comic sans MS"/>
<constructor-arg index="1" value="0"/>
<constructor-arg index="2" value="10"/>
</bean>
<bean id="fontLucida" class="java.awt.Font">
<constructor-arg index="0" value="Lucida console"/>
<constructor-arg index="1" value="0"/>
<constructor-arg index="2" value="10"/>
</bean>
<bean id="fontGenRandom" class="com.octo.captcha.component.image.fontgenerator.RandomFontGenerator">
<constructor-arg index="0" value="20"/>
<constructor-arg index="1" value="30"/>
<constructor-arg index="2">
<list>
<ref bean="fontArial"/>
<ref bean="fontTahoma"/>
<ref bean="fontVerdana"/>
<ref bean="fontComic"/>
<ref bean="fontLucida"/>
</list>
</constructor-arg>
</bean>
<bean id="backGenUni" class="com.octo.captcha.component.image.backgroundgenerator.UniColorBackgroundGenerator">
<constructor-arg index="0" value="150"/>
<constructor-arg index="1" value="50"/>
</bean>
<bean id="path" class="java.lang.String">
<constructor-arg value="\home\jcaptcha\conf\gimpybackgrounds"/>
</bean>
<bean id="simpleColoredPaster" class="com.octo.captcha.component.image.textpaster.RandomTextPaster">
<constructor-arg type="java.lang.Integer" index="0" value="4"/>
<constructor-arg type="java.lang.Integer" index="1" value="6"/>
<constructor-arg type="com.octo.captcha.component.image.color.ColorGenerator" index="2"
ref="colorGenRandomDark"/>
<constructor-arg index="3" value="true"/>
</bean>
<bean id="wordtoimage" class="com.octo.captcha.component.image.wordtoimage.ComposedWordToImage">
<constructor-arg index="0" ref="fontGenRandom"/>
<constructor-arg index="1" ref="backGenUni"/>
<constructor-arg index="2" ref="simpleColoredPaster"/>
</bean>
<bean id="filedict" class="com.octo.captcha.component.word.FileDictionary">
<constructor-arg index="0" value="toddlist"/>
</bean>
<bean id="wordgen" class="com.octo.captcha.component.word.wordgenerator.ComposeDictionaryWordGenerator">
<constructor-arg ref="filedict"/>
</bean>
<bean id="imageCaptchaFactory" class="com.octo.captcha.image.gimpy.GimpyFactory">
<constructor-arg ref="wordgen"/>
<constructor-arg ref="wordtoimage"/>
</bean>
<bean id="imageEngine" class="com.octo.captcha.engine.GenericCaptchaEngine">
<constructor-arg index="0">
<list>
<ref bean="imageCaptchaFactory"/>
</list>
</constructor-arg>
</bean>
<bean id="captchaService" class="com.octo.captcha.service.multitype.GenericManageableCaptchaService">
<constructor-arg index="0" ref="imageEngine"/>
<constructor-arg index="1" value="300"/>
<constructor-arg index="2" value="200000"/>
<!-- Umm... Why this is requred ...-->
<constructor-arg index="3" value="200000"/>
</bean>
</beans>

View File

@ -5,7 +5,7 @@
<bean id="userManager" class="com.wisemapping.dao.UserManagerImpl"> <bean id="userManager" class="com.wisemapping.dao.UserManagerImpl">
<property name="hibernateTemplate" ref="hibernateTemplate"/> <property name="hibernateTemplate" ref="hibernateTemplate"/>
<property name="passwordEncoder" ref="passwordEncoder"/> <!--<property name="encoder" ref="encoder"/>-->
</bean> </bean>
<bean id="mindmapManager" class="com.wisemapping.dao.MindmapManagerImpl"> <bean id="mindmapManager" class="com.wisemapping.dao.MindmapManagerImpl">

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<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"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:component-scan base-package="dw.spring3.rest.controller"/>
<!-- To enable @RequestMapping process on type level and method level -->
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>
<bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="classesToBeBound">
<list>
<value>com.wisemapping.model.User</value>
</list>
</property>
</bean>
<bean id="employees" class="org.springframework.web.servlet.view.xml.MarshallingView">
<constructor-arg ref="jaxbMarshaller"/>
</bean>
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="mediaTypes">
<map>
<entry key="xml" value="application/xml"/>
<entry key="html" value="text/html"/>
</map>
</property>
<property name="viewResolvers">
<list>
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver"/>
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/WEB-INF/jsp-rest"/>
<property name="suffix" value=".jsp"/>
</bean>
</list>
</property>
</bean>
<!--bean id="viewResolver" class="org.springframework.web.servlet.view.BeanNameViewResolver" /-->
<bean id="employeeController" class="com.wisemapping.rest.UserController">
<property name="jaxb2Mashaller" ref="jaxbMarshaller"/>
</bean>
</beans>

View File

@ -1,42 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans> <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:sec="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">
<bean id="viewSecurityAdvisor" <bean id="encoder"
class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor"> class="com.wisemapping.security.CustomPasswordEncoder"/>
<property name="advice">
<ref local="viewSecurityAdvice"/> <sec:http pattern="/css/*" security="none"/>
</property> <sec:http pattern="/js/*" security="none"/>
<property name="mappedNames"> <sec:http pattern="/images/*" security="none"/>
<list> <sec:http pattern="/favicon.ico" security="none"/>
<value>getMindmapUserBy</value> <sec:http pattern="/c/login*" security="none"/>
<value>getMindmapById</value> <sec:http pattern="/c/userregistration.htm" security="none"/>
</list> <sec:http pattern="/c/activation.htm" security="none"/>
</property> <sec:http pattern="/c/forgotpassword.htm" security="none"/>
<sec:http pattern="/c/home.htm" security="none"/>
<sec:http pattern="/c/try.htm" security="none"/>
<sec:http pattern="/c/search.htm" security="none"/>
<sec:http pattern="/c/keyboard.htm" security="none"/>
<sec:http pattern="/c/embeddedview*" security="none"/>
<sec:http pattern="/c/export.htm" security="none"/>
<sec:http pattern="/c/publicview.htm" security="none"/>
<sec:http pattern="/dwr/engine.js" security="none"/>
<sec:http pattern="/dwr/interface/loggerservice.js" security="none"/>
<sec:http pattern="/dwr/call/plaincall/loggerservice.logerror.dwr" security="none"/>
<sec:http use-expressions="true" >
<sec:intercept-url pattern="/**/*" access="isFullyAuthenticated()"/>
<sec:form-login login-page="/c/login.htm" default-target-url='/c/mymaps.htm'
always-use-default-target='true' authentication-failure-url="/c/login.htm?login_error=2"
login-processing-url="/j_spring_security_check"/>
<sec:remember-me key="rememberMeKey" user-service-ref="userDetailsService"/>
<!--<sec:session-management session-fixation-protection="newSession">-->
<!--<sec:concurrency-control error-if-maximum-exceeded="true" max-sessions="1"/>-->
<!--</sec:session-management>-->
<sec:logout logout-url="/c/logout.htm" invalidate-session="true" logout-success-url="/c/login.htm"/>
</sec:http>
<sec:authentication-manager alias="authenticationManager" >
<sec:authentication-provider ref="dbAuthenticationProvider"/>
<sec:authentication-provider user-service-ref="userDetailsService"/>
</sec:authentication-manager>
<bean id="dbAuthenticationProvider" class="com.wisemapping.security.AuthenticationProvider">
<property name="userManager" ref="userManager"/>
<property name="encoder" ref="encoder"/>
</bean> </bean>
<bean id="updateSecurityAdvisor" <bean id="userDetailsService" class="com.wisemapping.security.DatabaseUserDetailService">
class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor"> <property name="userManager" ref="userManager"/>
<property name="advice">
<ref local="updateSecurityAdvice"/>
</property>
<property name="mappedNames">
<list>
<value>update*</value>
<value>add*</value>
<value>remove*</value>
<value>remove*</value>
</list>
</property>
</bean>
<bean id="updateSecurityAdvice" class="com.wisemapping.security.aop.UpdateSecurityAdvise">
<property name="mindmapService" ref="mindmapService"/>
</bean>
<bean id="viewSecurityAdvice" class="com.wisemapping.security.aop.ViewBaseSecurityAdvise">
<property name="mindmapService" ref="mindmapService"/>
</bean> </bean>
</beans> </beans>

View File

@ -123,7 +123,7 @@
</bean> </bean>
<bean id="userController" class="com.wisemapping.controller.UserController"> <bean id="userController" class="com.wisemapping.controller.UserController">
<property name="captchaService" ref="captchaService"/> <!--<property name="captchaService" ref="captchaService"/>-->
<property name="sessionForm" value="false"/> <property name="sessionForm" value="false"/>
<property name="commandName" value="user"/> <property name="commandName" value="user"/>
<property name="commandClass" value="com.wisemapping.view.UserBean"/> <property name="commandClass" value="com.wisemapping.view.UserBean"/>
@ -279,9 +279,9 @@
<property name="mindmapService" ref="mindmapService"/> <property name="mindmapService" ref="mindmapService"/>
</bean> </bean>
<bean id="captchaController" class="com.wisemapping.controller.CaptchaController"> <!--<bean id="captchaController" class="com.wisemapping.controller.CaptchaController">-->
<property name="captchaService" ref="captchaService"/> <!--<property name="captchaService" ref="captchaService"/>-->
</bean> <!--</bean>-->
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="interceptors"> <property name="interceptors">
@ -297,7 +297,6 @@
<prop key="/c/sharing.htm">sharingController</prop> <prop key="/c/sharing.htm">sharingController</prop>
<prop key="/c/home.htm">homeController</prop> <prop key="/c/home.htm">homeController</prop>
<prop key="/c/login.htm">loginController</prop> <prop key="/c/login.htm">loginController</prop>
<prop key="/c/captcha.htm">captchaController</prop>
<prop key="/c/forgotPassword.htm">forgotPasswordController</prop> <prop key="/c/forgotPassword.htm">forgotPasswordController</prop>
<prop key="/c/activation.htm">activationController</prop> <prop key="/c/activation.htm">activationController</prop>
<prop key="/c/changePassword.htm">changePasswordController</prop> <prop key="/c/changePassword.htm">changePasswordController</prop>

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="wiseservices" class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
<constructor-arg value="/WEB-INF/wiseservices.wsdl"/>
</bean>
<bean id="orderEndpoint" class="com.wisemapping.ws.WiseWsEndpoint">
<constructor-arg ref="mindmapService"/>
<constructor-arg ref="userService"/>
</bean>
<bean class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
<constructor-arg ref="marshaller"/>
</bean>
<bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="classesToBeBound">
<list>
<value>com.wisemapping.ws.LoadMindmapRequest</value>
<value>com.wisemapping.ws.LoadMindmapResponse</value>
<value>com.wisemapping.ws.AddMindmapRequest</value>
<value>com.wisemapping.ws.AddMindmapResponse</value>
</list>
</property>
</bean>
<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping"/>
<!-- Security -->
<!--<bean id="springSecurityHandler"-->
<!--class="org.springframework.ws.soap.security.xwss.callback.SpringPlainTextPasswordValidationCallbackHandler">-->
<!--<property name="authenticationManager" ref="wsAuthenticationManager"/>-->
<!--</bean>-->
<!--<bean id="wsAuthenticationManager" class="org.springframework.security.providers.ProviderManager">-->
<!--<property name="providers">-->
<!--<bean class="org.springframework.security.providers.dao.DaoAuthenticationProvider">-->
<!--<property name="userDetailsService" ref="userDetailsService"/>-->
<!--</bean>-->
<!--</property>-->
<!--</bean>-->
</beans>

View File

@ -1,20 +1,20 @@
<%@ page import="org.acegisecurity.context.SecurityContextHolder" %> <%--<%@ page import="org.acegisecurity.context.SecurityContextHolder" %>--%>
<%@ page import="org.acegisecurity.Authentication" %> <%--<%@ page import="org.acegisecurity.Authentication" %>--%>
<%@ page import="org.acegisecurity.ui.AccessDeniedHandlerImpl" %> <%--<%@ page import="org.acegisecurity.ui.AccessDeniedHandlerImpl" %>--%>
<h1>Sorry, access is denied</h1> <%--<h1>Sorry, access is denied</h1>--%>
<p> <%--<p>--%>
<%= request.getAttribute(AccessDeniedHandlerImpl.ACEGI_SECURITY_ACCESS_DENIED_EXCEPTION_KEY)%> <%--<%= request.getAttribute(AccessDeniedHandlerImpl.ACEGI_SECURITY_ACCESS_DENIED_EXCEPTION_KEY)%>--%>
<p> <%--<p>--%>
<% <%--<%--%>
Authentication auth = SecurityContextHolder.getContext().getAuthentication(); <%--Authentication auth = SecurityContextHolder.getContext().getAuthentication();--%>
if (auth != null) { <%--if (auth != null) {--%>
%> <%--%>--%>
Authentication object as a String: <%= auth.toString() %><BR><BR> <%--Authentication object as a String: <%= auth.toString() %><BR><BR>--%>
<% } %> <%--<% } %>--%>

View File

@ -12,8 +12,8 @@
<link rel="stylesheet" type="text/css" href="../css/embedded.css"/> <link rel="stylesheet" type="text/css" href="../css/embedded.css"/>
<script type='text/javascript' src='../js/libraries/mootools/mootools-core-1.3.2-full-compress.js'></script> <script type='text/javascript' src='../js/mootools-core.js'></script>
<script type='text/javascript' src='../js/libraries/mootools/mootools-more-1.3.2.1-yui.js'></script> <script type='text/javascript' src='../js/mootools-more.js'></script>
<script type='text/javascript' src='../js/core.js'></script> <script type='text/javascript' src='../js/core.js'></script>

View File

@ -1,3 +1,3 @@
<% <%
response.sendRedirect(request.getContextPath() + "/c/login.htm"); response.sendRedirect(request.getContextPath() + "/c/mymaps.htm");
%> %>

View File

@ -26,7 +26,7 @@
<spring:message code="SIGN_IN"/> <spring:message code="SIGN_IN"/>
</h1> </h1>
<form action="<c:url value='j_acegi_security_check'/>" method="POST"> <form action="<c:url value='/j_spring_security_check'/>" method="POST">
<table> <table>
<tbody> <tbody>
<c:if test="${not empty param.login_error}"> <c:if test="${not empty param.login_error}">
@ -66,7 +66,7 @@
</tr> </tr>
<tr> <tr>
<td class="formLabel"> <td class="formLabel">
<input type="checkbox" id="rememberme" name="_acegi_security_remember_me"/> <input type="checkbox" id="rememberme" name="_spring_security_remember_me"/>
</td> </td>
<td> <td>
<spring:message code="REMEMBER_ME"/> <spring:message code="REMEMBER_ME"/>

View File

@ -14,7 +14,7 @@
<link rel="stylesheet" type="text/css" href="../css/mymaps.css"/> <link rel="stylesheet" type="text/css" href="../css/mymaps.css"/>
<link rel="icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon"/> <link rel="icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon"/> <link rel="shortcut icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon"/>
<script type='text/javascript' src='../js/libraries/mootools/mootools-core-1.3.2-full-compress.js'></script> <script type='text/javascript' src='../js/mootools-core.js'></script>
</head> </head>
<body> <body>
<div class="content"> <div class="content">

View File

@ -25,8 +25,8 @@
<link rel="stylesheet" type="text/css" href="../css/print.css"/> <link rel="stylesheet" type="text/css" href="../css/print.css"/>
<script type='text/javascript' src='../js/libraries/mootools/mootools-core-1.3.2-full-compress.js'></script> <script type='text/javascript' src='../js/mootools-core.js'></script>
<script type='text/javascript' src='../js/libraries/mootools/mootools-more-1.3.2.1-yui.js'></script> <script type='text/javascript' src='../js/mootools-more.js'></script>
<script type='text/javascript' src='../js/core.js'></script> <script type='text/javascript' src='../js/core.js'></script>

View File

@ -25,7 +25,7 @@
<link rel="shortcut icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon"/> <link rel="shortcut icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon"/>
<script type='text/javascript' <script type='text/javascript'
src='https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools-yui-compressed.js'></script> src='https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools-yui-compressed.js'></script>
<script type='text/javascript' src='../js/libraries/mootools/mootools-more-1.3.2.1-yui.js'></script> <script type='text/javascript' src='../js/mootools-more.js'></script>
</head> </head>
<body> <body>