Outh working!. Pending:
- Test all databases - Migration Scripts - Manage error due to changing of authentication schemas. - Link from the login page. - What happend with the logout ?.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright [2012] [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.service;
|
||||
|
||||
import com.wisemapping.exceptions.WiseMappingException;
|
||||
|
||||
public class InvalidAuthSchemaException extends WiseMappingException
|
||||
{
|
||||
public InvalidAuthSchemaException(String msg)
|
||||
{
|
||||
super(msg);
|
||||
}
|
||||
}
|
@@ -36,7 +36,7 @@ public interface UserService {
|
||||
|
||||
public void updateUser(User user);
|
||||
|
||||
public void resetPassword(@NotNull String email) throws InvalidUserEmailException;
|
||||
public void resetPassword(@NotNull String email) throws InvalidUserEmailException, InvalidAuthSchemaException;
|
||||
|
||||
public void deleteUser(@NotNull User user);
|
||||
|
||||
|
@@ -19,12 +19,10 @@
|
||||
package com.wisemapping.service;
|
||||
|
||||
import com.wisemapping.dao.UserManager;
|
||||
import com.wisemapping.exceptions.ClientException;
|
||||
import com.wisemapping.exceptions.WiseMappingException;
|
||||
import com.wisemapping.mail.NotificationService;
|
||||
import com.wisemapping.model.AccessAuditory;
|
||||
import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.model.*;
|
||||
import org.apache.velocity.app.VelocityEngine;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.context.MessageSource;
|
||||
@@ -59,9 +57,14 @@ public class UserServiceImpl
|
||||
|
||||
@Override
|
||||
public void resetPassword(@NotNull String email)
|
||||
throws InvalidUserEmailException {
|
||||
throws InvalidUserEmailException, InvalidAuthSchemaException {
|
||||
final User user = userManager.getUserBy(email);
|
||||
if (user != null) {
|
||||
|
||||
if (user.getAuthenticationSchema() != AuthenticationSchema.DATABASE) {
|
||||
throw new InvalidAuthSchemaException("Could not change password for " + user.getAuthenticationSchema().getCode());
|
||||
}
|
||||
|
||||
// Generate a random password ...
|
||||
final String password = randomstring(8, 10);
|
||||
user.setPassword(password);
|
||||
@@ -107,6 +110,7 @@ public class UserServiceImpl
|
||||
userManager.auditLogin(accessAuditory);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public User createUser(@NotNull User user, boolean emailConfirmEnabled, boolean welcomeEmail) throws WiseMappingException {
|
||||
final UUID uuid = UUID.randomUUID();
|
||||
user.setCreationDate(Calendar.getInstance());
|
||||
|
Reference in New Issue
Block a user