From: Roland Häder Date: Wed, 12 Jul 2017 19:02:54 +0000 (+0200) Subject: created new project based on juser-lib to swap out login/registration stuff X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=45908c8c77e54e6ef66f81b4949b1b2a2af557c6;p=juser-login-lib.git created new project based on juser-lib to swap out login/registration stuff Signed-off-by: Roland Häder --- diff --git a/build.xml b/build.xml index ce0b319..cf7cce4 100644 --- a/build.xml +++ b/build.xml @@ -7,8 +7,8 @@ - - Builds, tests, and runs the project juser-lib. + + Builds, tests, and runs the project juser-login-lib. - + @@ -475,7 +475,7 @@ is divided into following sections: - + @@ -626,7 +626,7 @@ is divided into following sections: - + @@ -918,7 +918,7 @@ is divided into following sections: - + @@ -1403,7 +1403,7 @@ is divided into following sections: - + diff --git a/nbproject/project.properties b/nbproject/project.properties index e0ca0b7..ec8432c 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -3,7 +3,7 @@ annotation.processing.enabled.in.editor=true annotation.processing.processors.list= annotation.processing.run.all.processors=true annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -application.title=juser-lib +application.title=juser-login-lib application.vendor=Roland H\u00e4der build.classes.dir=${build.dir}/classes build.classes.excludes=**/*.java,**/*.form @@ -25,17 +25,19 @@ debug.test.classpath=\ dist.archive.excludes= # This directory is removed when the project is cleaned: dist.dir=dist -dist.jar=${dist.dir}/juser-lib.jar +dist.jar=${dist.dir}/juser-login-lib.jar dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= file.reference.juser-core.jar=lib/juser-core.jar +file.reference.juser-login-core.jar=lib/juser-login-core.jar includes=** jar.archive.disabled=${jnlp.enabled} jar.compress=false jar.index=${jnlp.enabled} javac.classpath=\ ${file.reference.juser-core.jar}:\ + ${file.reference.juser-login-core.jar}:\ ${libs.javaee-api-7.0.classpath} # Space-separated list of extra javac options javac.compilerargs=-Xlint:unchecked -Xlint:deprecation @@ -90,5 +92,6 @@ run.test.classpath=\ ${build.test.classes.dir} source.encoding=UTF-8 source.reference.juser-core.jar=../juser-core/src/ +source.reference.juser-login-core.jar=../juser-login-core/src/ src.dir=src test.src.dir=test diff --git a/nbproject/project.xml b/nbproject/project.xml index d716dce..f5a0d2f 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -3,7 +3,7 @@ org.netbeans.modules.java.j2seproject - juser-lib + juser-login-lib diff --git a/src/org/mxchange/jusercore/model/login/user/UserLoginSessionBeanRemote.java b/src/org/mxchange/jusercore/model/login/user/UserLoginSessionBeanRemote.java deleted file mode 100644 index e56410d..0000000 --- a/src/org/mxchange/jusercore/model/login/user/UserLoginSessionBeanRemote.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jusercore.model.login.user; - -import java.io.Serializable; -import javax.ejb.Remote; -import org.mxchange.jusercore.container.login.LoginContainer; -import org.mxchange.jusercore.exceptions.UserNotFoundException; -import org.mxchange.jusercore.exceptions.UserPasswordMismatchException; -import org.mxchange.jusercore.exceptions.UserStatusLockedException; -import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException; -import org.mxchange.jusercore.model.user.User; - -/** - * A remote interface for user login - *

- * @author Roland Häder - */ -@Remote -public interface UserLoginSessionBeanRemote extends Serializable { - - /** - * Validates if the user is a confirmed account and returns the full user - * instance - *

- * @param container Login container holding user instance and clear-text password - *

- * @return Full confirmed user account - *

- * @throws org.mxchange.jusercore.exceptions.UserNotFoundException If the - * user account was not found - * @throws org.mxchange.jusercore.exceptions.UserStatusLockedException If - * the user account is locked - * @throws org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException - * If the user account is unconfirmed - * @throws org.mxchange.jusercore.exceptions.UserPasswordMismatchException - * If the password is not matching - */ - User validateUserAccountStatus (final LoginContainer container) throws UserNotFoundException, UserStatusLockedException, UserStatusUnconfirmedException, UserPasswordMismatchException; -} diff --git a/src/org/mxchange/jusercore/model/user/AdminUserSessionBeanRemote.java b/src/org/mxchange/jusercore/model/user/AdminUserSessionBeanRemote.java deleted file mode 100644 index c19070d..0000000 --- a/src/org/mxchange/jusercore/model/user/AdminUserSessionBeanRemote.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jusercore.model.user; - -import java.io.Serializable; -import javax.ejb.Remote; -import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException; -import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException; -import org.mxchange.jusercore.exceptions.UserNotFoundException; -import org.mxchange.jusercore.exceptions.UserStatusConfirmedException; -import org.mxchange.jusercore.exceptions.UserStatusLockedException; -import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException; - -/** - * An interface for administrative user beans - *

- * @author Roland Häder - */ -@Remote -public interface AdminUserSessionBeanRemote extends Serializable { - - /** - * Deletes given user instance - *

- * @param user User instance to delete - * @param userDeleteReason Delete reason - *

- * @throws UserNotFoundException If the user account is not found - */ - void deleteUser (final User user, final String userDeleteReason) throws UserNotFoundException; - - /** - * Locks given user account with given reason - *

- * @param user User account to be locked, must be status CONFIRMED - * @param userLockReason Lock reason - * @param baseUrl Base URL for all URLs - *

- * @return Updated (and detached) user instance - *

- * @throws UserStatusLockedException The account is already locked - * @throws UserStatusUnconfirmedException The account is not confirmed - * @throws UserNotFoundException The user account is not found - */ - User lockUserAccount (final User user, final String userLockReason, final String baseUrl) throws UserStatusLockedException, UserStatusUnconfirmedException, UserNotFoundException; - - /** - * Unlocks given user account - *

- * @param user User account to be unlocked, must be status LOCKED - * @param baseUrl Base URL for all URLs - *

- * @return Updated (and detached) user instance - *

- * @throws UserStatusConfirmedException The account is already locked - * @throws UserStatusUnconfirmedException The account is not confirmed - * @throws UserNotFoundException The user account is not found - */ - User unlockUserAccount (final User user, final String baseUrl) throws UserStatusConfirmedException, UserStatusUnconfirmedException, UserNotFoundException; - - /** - * Creates the user instance and links it with the set contact instance - *

- * @param user User instance to - *

- * @return Updated user instance - *

- * @throws UserNameAlreadyRegisteredException When the user name is already - * used - * @throws EmailAddressAlreadyRegisteredException When the email address is - * already used - */ - User linkUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException; - - /** - * Adds given user to database, if not found by user name or email address. - *

- * @param user User instance to add - *

- * @return Updated user instance - *

- * @throws UserNameAlreadyRegisteredException When the user name is already - * used - * @throws EmailAddressAlreadyRegisteredException When the email address is - * already used - */ - User addUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException; - -} diff --git a/src/org/mxchange/jusercore/model/user/UserSessionBeanRemote.java b/src/org/mxchange/jusercore/model/user/UserSessionBeanRemote.java deleted file mode 100644 index f590661..0000000 --- a/src/org/mxchange/jusercore/model/user/UserSessionBeanRemote.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jusercore.model.user; - -import java.io.Serializable; -import java.util.List; -import javax.ejb.Remote; -import org.mxchange.jusercore.exceptions.UserNotFoundException; -import org.mxchange.jusercore.exceptions.UserStatusConfirmedException; -import org.mxchange.jusercore.exceptions.UserStatusLockedException; -import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException; -import org.mxchange.jusercore.model.user.password_history.PasswordHistory; - -/** - * An interface for user beans - *

- * @author Roland Häder - */ -@Remote -public interface UserSessionBeanRemote extends Serializable { - - /** - * Updates user's password (must be set encrypted before calling this - * method) and records the password change in user's password history. - *

- * @param user User instance with updated password - * @param baseUrl Base URL for all links - *

- * @return Password history entry with updated user instance - * - * @throws UserNotFoundException If the user is not found - * @throws UserStatusUnconfirmedException If the user status is unconfirmed - * @throws UserStatusLockedException If the user status is locked - */ - PasswordHistory updateUserPassword (final User user, final String baseUrl) throws UserNotFoundException, UserStatusUnconfirmedException, UserStatusLockedException; - - /** - * Changes the user' account status to CONFIRMED if the status is - * UNCONFIRMED, else propper exceptions are thrown. - *

- * @param user Unconfirmed user instance - * @param baseUrl Base URL - *

- * @return Updated user instance - *

- * @throws UserStatusConfirmedException If the user account is confirmed - * @throws UserStatusLockedException If the user account is locked - */ - User confirmAccount (final User user, final String baseUrl) throws UserStatusConfirmedException, UserStatusLockedException; - - /** - * Generates random user name that is available. - *

- * @return Generated user name - */ - String generateRandomUserName (); - - /** - * Updates entiity from given user instance and returns updated instance. - *

- * @param user User instance to update - *

- * @return Updated user instance - */ - User updateUserData (final User user); - - /** - * Find user by given user id and returns fetched instance. If the user is - * not found, an exception is thrown. - *

- * @param userId User id - *

- * @return User instance - * - * @throws org.mxchange.jusercore.exceptions.UserNotFoundException If the - * user is not found - */ - User findUserById (final Long userId) throws UserNotFoundException; - - /** - * Returns a list of all users. This is mostly suitable for administrative - * interfaces. - *

- * @return A list of all users - */ - List allUsers (); - - /** - * Returns a list with all public and member-visible users. Members are - * logged-in users. ;-) - *

- * @return A list of public and member-visible users - */ - List allMemberPublicVisibleUsers (); - - /** - * Returns a list of all public user profiles - *

- * @return A list of all public user profiles - */ - List allPublicUsers (); - - /** - * Fills given user instance with all available data - *

- * @param user Initial User instance - *

- * @return Prepared User instance - */ - User fillUserData (final User user); - - /** - * Some "getter" for a full user name list - *

- * @return User name list - */ - List getUserNameList (); - - /** - * Some "getter" for a full email address list - *

- * @return User name list - */ - List getEmailAddressList (); - - /** - * Checks if given user id exists - *

- * @param userId User id to check - *

- * @return Whether the user id exists - */ - boolean ifUserIdExists (final Long userId); - - /** - * Checks if given user name is already used - *

- * @param userName User name to check - *

- * @return Whether given user name is found - */ - boolean ifUserNameExists (final String userName); - - /** - * Checks if given user exists - *

- * @param user User to check - *

- * @return Whether the user exists - */ - boolean ifUserExists (final User user); - - /** - * Checks if the the given user's name is already registered - *

- * @param user User instance - *

- * @return Whether the user is already registered - */ - boolean isUserNameRegistered (final User user); - - /** - * Checks if the the given user's email address is already registered - *

- * @param user User instance - *

- * @return Whether the user is already registered - */ - boolean isEmailAddressRegistered (final User user); - - /** - * Updates given user instance in database - *

- * @param user User instance to update - *

- * @return Updated user instance (detached) - */ - User updateUserPersonalData (final User user); - -} diff --git a/src/org/mxchange/jusercore/model/user/email_address/UserEmailChangeSessionBeanRemote.java b/src/org/mxchange/jusercore/model/user/email_address/UserEmailChangeSessionBeanRemote.java deleted file mode 100644 index 36aea74..0000000 --- a/src/org/mxchange/jusercore/model/user/email_address/UserEmailChangeSessionBeanRemote.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jusercore.model.user.email_address; - -import java.io.Serializable; -import java.util.List; -import javax.ejb.Remote; -import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress; - -/** - * A remote interface for changing email addresses - *

- * @author Roland Häder - */ -@Remote -public interface UserEmailChangeSessionBeanRemote extends Serializable { - - /** - * Checks whether given email address is already enqueued - *

- * @param emailAddress Email address to check - *

- * @return Whether the email address has already been enqueued - */ - boolean isEmailAddressEnqueued (final String emailAddress); - - /** - * Returns a list of all queued email addresses, not limited to a user - *

- * @return A list of all queued email addresses - */ - List allQueuedAddresses (); - - /** - * "Enqueues" given email change object - *

- * @param emailChange Email change instance to insert - * @param baseUrl Base URL - */ - void enqueueEmailAddressForChange (final ChangeableEmailAddress emailChange, final String baseUrl); - - /** - * Updates given user's email address. - *

- * @param emailChange Email change instance to mark as used - */ - void updateEmailAddress (final ChangeableEmailAddress emailChange); - -} diff --git a/src/org/mxchange/jusercore/model/user/password_history/UserPasswordHistorySessionBeanRemote.java b/src/org/mxchange/jusercore/model/user/password_history/UserPasswordHistorySessionBeanRemote.java deleted file mode 100644 index 9ecce09..0000000 --- a/src/org/mxchange/jusercore/model/user/password_history/UserPasswordHistorySessionBeanRemote.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jusercore.model.user.password_history; - -import java.io.Serializable; -import java.util.List; -import javax.ejb.Remote; -import org.mxchange.jusercore.model.user.User; - -/** - * A remote interface for user's password history - *

- * @author Roland Häder - */ -@Remote -public interface UserPasswordHistorySessionBeanRemote extends Serializable { - - /** - * Returns a list of user's password history entries ("unlimited"). The - * application then should limit the amount by itself for its specific - * purpose. If the user has never changed password, an empty list is being - * returned. - *

- * @param user User instance to get all password histories for - *

- * @return List of all user's password history - */ - List getUserPasswordHistory (final User user); - -} diff --git a/src/org/mxchange/jusercore/model/user/register/UserRegistrationSessionBeanRemote.java b/src/org/mxchange/jusercore/model/user/register/UserRegistrationSessionBeanRemote.java deleted file mode 100644 index 817d05f..0000000 --- a/src/org/mxchange/jusercore/model/user/register/UserRegistrationSessionBeanRemote.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jusercore.model.user.register; - -import java.io.Serializable; -import javax.ejb.Remote; -import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException; -import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException; -import org.mxchange.jusercore.model.user.User; - -/** - * A remote interface for user registration - *

- * @author Roland Häder - */ -@Remote -public interface UserRegistrationSessionBeanRemote extends Serializable { - - /** - * Generates a non-existing confirmation key for given user instance. The - * user instance is being used as entropy source to make the key more harder - * to "guess". - *

- * @param user User instance - *

- * @return Non-existing confirmation key - */ - String generateConfirmationKey (User user); - - /** - * Registers given user data, if not yet found - *

- * @param user User instance to register - * @param baseUrl Base URL - * @param randomPassword A randomly-generated password or NULL if user had - * to enter it. - *

- * @return The fully registered user account - *

- * @throws UserNameAlreadyRegisteredException If the user name has already - * been registered - * @throws EmailAddressAlreadyRegisteredException If the email address has - * already been registered - */ - User registerUser (final User user, final String baseUrl, final String randomPassword) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException; - - /** - * Checks if the user's name is already registered - *

- * @param user User instance to check - *

- * @return Whether the user's name has already been registered - */ - boolean isUserNameRegistered (final User user); - - /** - * Checks if the user's email address is already registered - *

- * @param user User instance to check - *

- * @return Whether the user's email address has already been registered - */ - boolean isEmailAddressRegistered (final User user); -} diff --git a/src/org/mxchange/jusercore/model/user/resendlink/ResendLinkSessionBeanRemote.java b/src/org/mxchange/jusercore/model/user/resendlink/ResendLinkSessionBeanRemote.java deleted file mode 100644 index dcd1332..0000000 --- a/src/org/mxchange/jusercore/model/user/resendlink/ResendLinkSessionBeanRemote.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jusercore.model.user.resendlink; - -import java.io.Serializable; -import java.util.Locale; -import javax.ejb.Remote; -import org.mxchange.jusercore.exceptions.UserNotFoundException; -import org.mxchange.jusercore.exceptions.UserStatusConfirmedException; -import org.mxchange.jusercore.exceptions.UserStatusLockedException; -import org.mxchange.jusercore.model.user.User; - -/** - * A remote interface for resending confirmation link. - *

- * @author Roland Häder - */ -@Remote -public interface ResendLinkSessionBeanRemote extends Serializable { - - /** - * Send confirmation link out to given user and returns a proper redirection - * target. The user's account status should be UNCONFIRMED and should - * contain a confirmation key. After confirmation the account's status - * should be changed to CONFIRMED and the key removed (nulled). - *

- * @param user User instance - * @param locale Locale instance - * @param baseUrl Base URL - *

- * @return Updated (aka "managed") instance with new confirmation key - * - * @throws UserNotFoundException If the user's account was not found - * @throws UserStatusLockedException If the user's account is locked - * @throws UserStatusConfirmedException If the user's account is already - * confirmed - */ - User resendConfirmationLink (final User user, final Locale locale, final String baseUrl) throws UserNotFoundException, UserStatusLockedException, UserStatusConfirmedException; - -} diff --git a/src/org/mxchange/juserlogincore/model/login/user/UserLoginSessionBeanRemote.java b/src/org/mxchange/juserlogincore/model/login/user/UserLoginSessionBeanRemote.java new file mode 100644 index 0000000..4d2cc0c --- /dev/null +++ b/src/org/mxchange/juserlogincore/model/login/user/UserLoginSessionBeanRemote.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.juserlogincore.model.login.user; + +import java.io.Serializable; +import javax.ejb.Remote; +import org.mxchange.jusercore.exceptions.UserNotFoundException; +import org.mxchange.jusercore.exceptions.UserStatusLockedException; +import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException; +import org.mxchange.jusercore.model.user.User; +import org.mxchange.juserlogincore.container.login.LoginContainer; +import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException; + +/** + * A remote interface for user login + *

+ * @author Roland Häder + */ +@Remote +public interface UserLoginSessionBeanRemote extends Serializable { + + /** + * Validates if the user is a confirmed account and returns the full user + * instance + *

+ * @param container Login container holding user instance and clear-text password + *

+ * @return Full confirmed user account + *

+ * @throws org.mxchange.jusercore.exceptions.UserNotFoundException If the + * user account was not found + * @throws org.mxchange.jusercore.exceptions.UserStatusLockedException If + * the user account is locked + * @throws org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException + * If the user account is unconfirmed + * @throws org.mxchange.jusercore.exceptions.UserPasswordMismatchException + * If the password is not matching + */ + User validateUserAccountStatus (final LoginContainer container) throws UserNotFoundException, UserStatusLockedException, UserStatusUnconfirmedException, UserPasswordMismatchException; +} diff --git a/src/org/mxchange/juserlogincore/model/user/register/UserRegistrationSessionBeanRemote.java b/src/org/mxchange/juserlogincore/model/user/register/UserRegistrationSessionBeanRemote.java new file mode 100644 index 0000000..55517b1 --- /dev/null +++ b/src/org/mxchange/juserlogincore/model/user/register/UserRegistrationSessionBeanRemote.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.juserlogincore.model.user.register; + +import java.io.Serializable; +import javax.ejb.Remote; +import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException; +import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException; +import org.mxchange.jusercore.model.user.User; + +/** + * A remote interface for user registration + *

+ * @author Roland Häder + */ +@Remote +public interface UserRegistrationSessionBeanRemote extends Serializable { + + /** + * Generates a non-existing confirmation key for given user instance. The + * user instance is being used as entropy source to make the key more harder + * to "guess". + *

+ * @param user User instance + *

+ * @return Non-existing confirmation key + */ + String generateConfirmationKey (User user); + + /** + * Registers given user data, if not yet found + *

+ * @param user User instance to register + * @param baseUrl Base URL + * @param randomPassword A randomly-generated password or NULL if user had + * to enter it. + *

+ * @return The fully registered user account + *

+ * @throws UserNameAlreadyRegisteredException If the user name has already + * been registered + * @throws EmailAddressAlreadyRegisteredException If the email address has + * already been registered + */ + User registerUser (final User user, final String baseUrl, final String randomPassword) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException; + + /** + * Checks if the user's name is already registered + *

+ * @param user User instance to check + *

+ * @return Whether the user's name has already been registered + */ + boolean isUserNameRegistered (final User user); + + /** + * Checks if the user's email address is already registered + *

+ * @param user User instance to check + *

+ * @return Whether the user's email address has already been registered + */ + boolean isEmailAddressRegistered (final User user); +} diff --git a/src/org/mxchange/juserlogincore/model/user/resendlink/ResendLinkSessionBeanRemote.java b/src/org/mxchange/juserlogincore/model/user/resendlink/ResendLinkSessionBeanRemote.java new file mode 100644 index 0000000..2e4e475 --- /dev/null +++ b/src/org/mxchange/juserlogincore/model/user/resendlink/ResendLinkSessionBeanRemote.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.juserlogincore.model.user.resendlink; + +import java.io.Serializable; +import java.util.Locale; +import javax.ejb.Remote; +import org.mxchange.jusercore.exceptions.UserNotFoundException; +import org.mxchange.jusercore.exceptions.UserStatusConfirmedException; +import org.mxchange.jusercore.exceptions.UserStatusLockedException; +import org.mxchange.jusercore.model.user.User; + +/** + * A remote interface for resending confirmation link. + *

+ * @author Roland Häder + */ +@Remote +public interface ResendLinkSessionBeanRemote extends Serializable { + + /** + * Send confirmation link out to given user and returns a proper redirection + * target. The user's account status should be UNCONFIRMED and should + * contain a confirmation key. After confirmation the account's status + * should be changed to CONFIRMED and the key removed (nulled). + *

+ * @param user User instance + * @param locale Locale instance + * @param baseUrl Base URL + *

+ * @return Updated (aka "managed") instance with new confirmation key + * + * @throws UserNotFoundException If the user's account was not found + * @throws UserStatusLockedException If the user's account is locked + * @throws UserStatusConfirmedException If the user's account is already + * confirmed + */ + User resendConfirmationLink (final User user, final Locale locale, final String baseUrl) throws UserNotFoundException, UserStatusLockedException, UserStatusConfirmedException; + +}