From 585b6d7d026da574840ab3a16580a67b93882a91 Mon Sep 17 00:00:00 2001
From: Joern Muehlencord
Date: Fri, 13 Sep 2019 01:02:27 +0200
Subject: [PATCH] migrated shared-account into own project, updated license
heaaders
---
.gitignore | 189 +++++++-
account-dao/pom.xml | 53 ---
.../shared/account/dao/ApiKeyObject.java | 104 -----
.../shared/account/dao/ApiKeyUtil.java | 43 --
.../shared/account/dao/JacksonConfig.java | 30 --
.../shared/account/dao/ApiKeyObjectTest.java | 41 --
account-ui/faces-config.NavData | 6 -
account-ui/nb-configuration.xml | 22 -
account-ui/pom.xml | 152 -------
.../src/main/filters/development.properties | 8 -
.../src/main/filters/production.properties | 18 -
.../account/web/EnsurePermissionsBean.java | 80 ----
.../account/web/FacesContextProducer.java | 40 --
.../account/web/PermissionConstants.java | 86 ----
.../web/PersistenceContextFactory.java | 69 ---
.../account/web/ResourceBundleProducer.java | 53 ---
.../account/web/presentation/AccountView.java | 296 ------------
.../web/presentation/ApplicationView.java | 155 -------
.../web/presentation/InstanceView.java | 55 ---
.../web/presentation/PermissionView.java | 143 ------
.../account/web/presentation/RoleView.java | 236 ----------
.../UniqueApplicationRoleNameValidator.java | 67 ---
.../UniqueApplicationValidator.java | 60 ---
.../UniquePermissionNameValidator.java | 68 ---
.../main/resources/META-INF/persistence.xml | 25 -
.../main/resources/admin-config.properties | 38 --
.../src/main/resources/buildInfo.properties | 3 -
.../web/presentation/messages.properties | 133 ------
.../web/presentation/messages_de.properties | 134 ------
.../web/presentation/messages_en.properties | 134 ------
account-ui/src/main/webapp/WEB-INF/beans.xml | 7 -
.../src/main/webapp/WEB-INF/faces-config.xml | 22 -
.../src/main/webapp/WEB-INF/jboss-web.xml | 7 -
account-ui/src/main/webapp/WEB-INF/shiro.ini | 59 ---
account-ui/src/main/webapp/WEB-INF/web.xml | 123 -----
account-ui/src/main/webapp/index.xhtml | 23 -
account-ui/src/main/webapp/login.xhtml | 96 ----
account-ui/src/main/webapp/logout.xhtml | 15 -
.../composite/confirmationDialog.xhtml | 21 -
.../src/main/webapp/resources/css/admin.css | 18 -
.../webapp/resources/template/footer.xhtml | 15 -
.../webapp/resources/template/leftmenu.xhtml | 62 ---
.../webapp/resources/template/template.xhtml | 50 --
account-ui/src/main/webapp/web/accounts.xhtml | 341 --------------
.../src/main/webapp/web/applications.xhtml | 101 -----
account-ui/src/main/webapp/web/index.xhtml | 13 -
.../src/main/webapp/web/permissions.xhtml | 108 -----
account-ui/src/main/webapp/web/roles.xhtml | 135 ------
account/pom.xml | 117 -----
account/sql/account.dbm | 410 -----------------
account/sql/account.sql | 251 ----------
account/sql/account_prefill.sql | 29 --
account/sql/backupAccount.bat | 4 -
account/sql/backupAccountTest.bat | 4 -
account/sql/createDatabaseFileFromDBM.bat | 9 -
account/sql/drop_all_tables.sql | 11 -
account/sql/restoreAccount.bat | 5 -
account/sql/restoreAccountTest.bat | 5 -
.../account/boundary/AccountPermissions.java | 51 ---
.../account/boundary/AccountProducer.java | 123 -----
.../account/boundary/ApiKeyError.java | 54 ---
.../account/boundary/ApiKeyException.java | 49 --
.../account/boundary/ApiKeyService.java | 340 --------------
.../account/control/AccountControl.java | 427 ------------------
.../business/account/entity/Account.java | 28 --
.../entity/AccountConfigurationKey.java | 29 --
.../entity/AccountConfigurationValue.java | 40 --
.../account/entity/AccountEntity.java | 285 ------------
.../account/entity/AccountException.java | 44 --
.../account/entity/AccountHistoryEntity.java | 189 --------
.../account/entity/AccountLoginEntity.java | 255 -----------
.../account/entity/AccountStatus.java | 41 --
.../business/account/entity/ApiKeyEntity.java | 171 -------
.../business/account/entity/JWTObject.java | 57 ---
.../boundary/ApplicationError.java | 46 --
.../control/ApplicationControl.java | 130 ------
.../control/ApplicationPermissionControl.java | 165 -------
.../control/ApplicationRoleControl.java | 209 ---------
.../application/entity/ApplicationEntity.java | 155 -------
.../entity/ApplicationPermissionEntity.java | 188 --------
.../entity/ApplicationRoleEntity.java | 198 --------
.../config/boundary/ConfigService.java | 277 ------------
.../boundary/ConfigurationProducer.java | 62 ---
.../business/config/entity/ConfigEntity.java | 163 -------
.../config/entity/ConfigEntityPK.java | 113 -----
.../config/entity/ConfigException.java | 53 ---
.../boundary/ApplicationPermissions.java | 63 ---
.../instance/boundary/StartupBean.java | 76 ----
.../control/ApplicationController.java | 121 -----
.../business/mail/boundary/MailService.java | 235 ----------
.../mail/boundary/MailTemplateService.java | 106 -----
.../business/mail/entity/MailDatamodel.java | 55 ---
.../business/mail/entity/MailException.java | 51 ---
.../mail/entity/MailTemplateEntity.java | 122 -----
.../mail/entity/MailTemplateException.java | 52 ---
.../account/presentation/LoginView.java | 201 ---------
.../presentation/LostPasswordView.java | 63 ---
.../account/shiro/authc/JwtMatcher.java | 119 -----
.../shiro/filter/JWTAuthenticationFilter.java | 169 -------
.../pam/AllSupportedSuccessfulStrategy.java | 82 ----
.../account/shiro/realm/AccountRealm.java | 305 -------------
.../realm/UserNameActiveDirectoryRealm.java | 179 --------
.../shiro/token/JWTAuthenticationToken.java | 60 ---
.../shared/account/util/AccountPU.java | 36 --
.../util/AccountSecurityException.java | 54 ---
.../util/AccountSecurityExceptionMapper.java | 32 --
.../AccountTransactionJoinInterceptor.java | 61 ---
.../shared/account/util/Permission.java | 28 --
.../shared/account/util/SecurityError.java | 27 --
.../shared/account/util/SecurityUtil.java | 70 ---
.../main/resources/META-INF/persistence.xml | 14 -
.../account/boundary/ApiKeyError.properties | 16 -
.../boundary/ApiKeyError_de_DE.properties | 16 -
.../boundary/ApiKeyError_en_US.properties | 16 -
.../ApplicationServiceError.properties | 16 -
.../ApplicationServiceError_de_DE.properties | 16 -
.../ApplicationServiceError_en_US.properties | 16 -
.../account/boundary/ApiKeyServiceTest.java | 105 -----
.../config/boundary/ConfigServiceTest.java | 76 ----
.../UserNameActiveDirectoryRealmTest.java | 75 ---
.../shared/account/util/SecurityUtilTest.java | 32 --
account/src/test/resources/log4j.xml | 37 --
account/src/test/resources/shiro.ini | 25 -
account/src/test/resources/shiro.ini.dist | 30 --
configuration/pom.xml | 16 +
.../configuration/BooleanParameter.java | 15 +
.../shared/configuration/Configuration.java | 15 +
.../configuration/ConfigurationException.java | 17 +-
.../configuration/ConverterException.java | 17 +-
.../shared/configuration/DateParameter.java | 15 +
.../configuration/DefaultConfiguration.java | 15 +
.../configuration/IntegerParameter.java | 15 +
.../shared/configuration/Parameter.java | 17 +-
.../configuration/ParameterFactory.java | 17 +-
.../shared/configuration/StringConverter.java | 17 +-
.../shared/configuration/StringParameter.java | 15 +
.../shared/configuration/URIParameter.java | 15 +
.../configuration/ValidationException.java | 15 +
.../shared/configuration/Validator.java | 15 +
.../converter/BooleanStringConverter.java | 15 +
.../converter/DateStringConverter.java | 17 +-
.../converter/IntegerStringConverter.java | 17 +-
.../converter/StringStringConverter.java | 17 +-
.../converter/URIStringConverter.java | 17 +-
.../validator/IntgerRangeValidator.java | 15 +
.../validator/StringValueListValidator.java | 15 +
db/pom.xml | 26 +-
.../shared/db/AbstractController.java | 4 +-
.../muehlencord/shared/db/ApplicationPU.java | 2 +-
...ApplicationTransactionJoinInterceptor.java | 2 +-
.../java/de/muehlencord/shared/db/Audit.java | 6 +-
.../muehlencord/shared/db/AuditListener.java | 6 +-
.../de/muehlencord/shared/db/Auditable.java | 6 +-
.../shared/db/CommonAbstractController.java | 6 +-
.../shared/db/ControllerException.java | 6 +-
.../de/muehlencord/shared/db/EndDateable.java | 4 +-
.../de/muehlencord/shared/db/EntityUtil.java | 6 +-
.../shared/db/IdentifiableEntity.java | 4 +-
.../shared/db/StandardController.java | 6 +-
.../de/muehlencord/shared/db/Validity.java | 2 +-
db/src/main/resources/log4j.xml | 18 +-
.../muehlencord/shared/db/CounterEntity.java | 17 +-
.../muehlencord/shared/db/EntityUtilTest.java | 6 +-
.../de/muehlencord/shared/db/TestEntity.java | 17 +-
jeeutil/pom.xml | 2 +-
.../shared/jeeutil/DefaultUIMessage.java | 2 +-
.../muehlencord/shared/jeeutil/FacesUtil.java | 4 +-
.../shared/jeeutil/GenericEnumType.java | 2 +-
.../muehlencord/shared/jeeutil/UIMessage.java | 4 +-
.../shared/jeeutil/UIMessageType.java | 4 +-
.../shared/jeeutil/jwt/JWTDecoder.java | 2 +-
.../shared/jeeutil/jwt/JWTEncoder.java | 2 +-
.../shared/jeeutil/jwt/JWTException.java | 2 +-
.../shared/jeeutil/jwt/JWTGuard.java | 2 +-
.../shared/jeeutil/restexfw/APIError.java | 4 +-
.../jeeutil/restexfw/APIErrorResponse.java | 4 +-
.../shared/jeeutil/restexfw/APIException.java | 4 +-
.../restexfw/APIExceptionInterceptor.java | 4 +-
.../jeeutil/restexfw/BadRequestMapper.java | 2 +-
.../restexfw/ConstraintViolationEntry.java | 4 +-
.../restexfw/ConstraintViolationMapper.java | 4 +-
.../jeeutil/restexfw/ForbiddenMapper.java | 2 +-
.../jeeutil/restexfw/NotAcceptableMapper.java | 2 +-
.../jeeutil/restexfw/NotAllowedMapper.java | 2 +-
.../jeeutil/restexfw/NotAuthorizedMapper.java | 2 +-
.../jeeutil/restexfw/NotFoundMapper.java | 2 +-
.../jeeutil/restexfw/NotSupportMapper.java | 2 +-
.../restexfw/ResponseStatusAdapter.java | 4 +-
.../restexfw/ValidationController.java | 4 +-
.../shared/jeeutil/validator/Email.java | 2 +-
.../EmailClientValidationConstraint.java | 2 +-
.../validator/EmailConstraintValidator.java | 2 +-
.../jeeutil/validator/EmailValidator.java | 2 +-
network/nb-configuration.xml | 16 +
network/pom.xml | 15 +
.../muehlencord/shared/network/CidrTool.java | 17 +-
.../shared/network/IpInformation.java | 17 +-
.../shared/network/NetworkScanner.java | 17 +-
.../shared/network/PortInformation.java | 17 +-
.../muehlencord/shared/network/PortScan.java | 17 +-
.../shared/network/PortScanner.java | 17 +-
.../shared/network/ftp/FTPConnection.java | 15 +
.../network/ftp/FTPConnectionException.java | 17 +-
.../shared/network/http/HttpLayer.java | 15 +
.../network/http/MessageNotSendException.java | 15 +
.../shared/network/ldap/LDAPConnection.java | 15 +
.../shared/network/ldap/LDAPContact.java | 15 +
.../shared/network/ldap/LDAPException.java | 15 +
.../shared/network/ldap/LDAPSearch.java | 19 +-
.../network/mail/DefaultMailReader.java | 15 +
.../shared/network/mail/MailMessage.java | 16 +-
.../network/mail/MailMessageException.java | 15 +
.../shared/network/mail/MailMessageUtils.java | 15 +-
.../shared/network/mail/MailProtocol.java | 15 +
.../shared/network/mail/MailReader.java | 17 +-
.../network/mail/MailReaderConfiguration.java | 15 +
.../MailReaderConfigurationException.java | 15 +
.../mail/MailReaderConfigurationFactory.java | 15 +
.../mail/MailReaderConnectionException.java | 17 +-
.../network/mail/MailReaderException.java | 17 +-
.../mail/exchange/ExchangeMailReader.java | 15 +
.../network/mail/imap/ImapMailReader.java | 15 +
.../network/whois/AbstractWhoisParser.java | 17 +-
.../shared/network/whois/ArinWhoisParser.java | 15 +
.../network/whois/DefaultWhoisParser.java | 17 +-
.../network/whois/NetworkInformation.java | 17 +-
.../shared/network/whois/Whois.java | 15 +
.../shared/network/whois/WhoisException.java | 17 +-
.../network/whois/WhoisInformation.java | 15 +
.../shared/network/whois/WhoisParser.java | 19 +-
.../src/main/resources/buildInfo.properties | 15 +
.../muehlencord/shared/network/BaseTest.java | 15 +
.../shared/network/CidrToolTest.java | 19 +-
.../shared/network/NetworkScannerTest.java | 17 +-
.../shared/network/PortScannerTest.java | 17 +-
.../shared/network/RangeToCidrTest.java | 17 +-
.../shared/network/ftp/FTPConnectionTest.java | 17 +-
.../shared/network/http/HttpLayerTest.java | 19 +-
.../network/mail/MailMessageUtilsTest.java | 15 +
.../shared/network/mail/TestSendMail.java | 15 +
.../mail/exchange/ExchangeMailReaderTest.java | 15 +
.../network/mail/imap/ImapMailReaderTest.java | 17 +-
.../network/whois/ArinWhoisParserTest.java | 17 +-
.../shared/network/whois/WhoisTest.java | 17 +-
network/src/test/resources/log4j.xml | 20 +-
network/src/test/resources/test.properties | 16 +-
.../src/test/resources/testprod.properties | 16 +-
pdf/pom.xml | 16 +
.../de/muehlencord/shared/pdf/CellValue.java | 17 +-
.../shared/pdf/ColumnDefinition.java | 17 +-
.../shared/pdf/ConfigurationException.java | 17 +-
.../de/muehlencord/shared/pdf/Content.java | 17 +-
.../de/muehlencord/shared/pdf/Coordinate.java | 17 +-
.../shared/pdf/DefaultTableRow.java | 17 +-
.../DefaultTableRowTypeAdapterFactory.java | 17 +-
.../pdf/GsonCustomizedTypeAdapterFactory.java | 17 +-
.../de/muehlencord/shared/pdf/GsonUtil.java | 17 +-
.../shared/pdf/InterfaceAdapter.java | 17 +-
.../muehlencord/shared/pdf/PDFDocument.java | 17 +-
.../de/muehlencord/shared/pdf/PDFFont.java | 17 +-
.../shared/pdf/PDFImageContent.java | 17 +-
.../PDFImageContentTypeAdapterFactory.java | 17 +-
.../muehlencord/shared/pdf/PDFPaperSize.java | 17 +-
.../shared/pdf/PDFTableContent.java | 17 +-
.../PDFTableContentTypeAdapterFactory.java | 17 +-
.../muehlencord/shared/pdf/PDFTemplate.java | 17 +-
.../shared/pdf/PDFTextAlignment.java | 17 +-
.../shared/pdf/PDFTextContent.java | 17 +-
.../pdf/PDFTextContentTypeAdapterFactory.java | 17 +-
.../de/muehlencord/shared/pdf/TableRow.java | 17 +-
.../shared/pdf/TemplateException.java | 17 +-
.../shared/pdf/TemplateSerializeable.java | 17 +-
.../muehlencord/shared/pdf/TextCellValue.java | 17 +-
.../pdf/TextCellValueTypeAdapterFactory.java | 17 +-
.../muehlencord/shared/pdf/TextElement.java | 17 +-
.../shared/pdf/util/ImageUtil.java | 17 +-
.../shared/pdf/DefaultTableRowTest.java | 17 +-
.../de/muehlencord/shared/pdf/Invoice.java | 17 +-
.../muehlencord/shared/pdf/InvoiceLine.java | 17 +-
.../muehlencord/shared/pdf/PDFFontTest.java | 17 +-
.../shared/pdf/PDFImageContentTest.java | 17 +-
.../shared/pdf/PDFTextContentTest.java | 17 +-
.../de/muehlencord/shared/pdf/TextTest.java | 17 +-
.../shared/pdf/test/GsonSerialisation.java | 17 +-
.../shared/pdf/test/PDFDocumentTest.java | 17 +-
.../de/muehlencord/shared/pdf/test/User.java | 17 +-
.../shared/pdf/util/ImageUtilTest.java | 18 +-
pdf/src/test/resources/log4j.xml | 16 +
poi-util/pom.xml | 16 +
.../muehlencord/shared/poi/PoiException.java | 6 +-
.../de/muehlencord/shared/poi/PoiUtil.java | 2 +-
.../muehlencord/shared/poi/WorkbookApp.java | 2 +-
pom.xml | 47 +-
security/pom.xml | 46 --
.../de/muehlencord/shared/security/Luhn.java | 64 ---
.../shared/security/OldPasswordUtil.java | 239 ----------
.../shared/security/PasswordUtil.java | 69 ---
.../shared/security/SecurityException.java | 29 --
.../muehlencord/shared/security/LuhnTest.java | 60 ---
.../shared/security/OldPasswordUtilTest.java | 154 -------
.../shared/security/PasswordUtilTest.java | 44 --
shiro-faces/pom.xml | 16 +
...AjaxAwarePassThruAuthenticationFilter.java | 15 +
.../tags/AbstractAccessControlTag.java | 4 +-
.../tags/AbstractAuthenticationTag.java | 4 +-
.../tags/AbstractPermissionTag.java | 4 +-
.../shirofaces/tags/AbstractRoleTag.java | 4 +-
.../shirofaces/tags/AbstractTag.java | 4 +-
.../shirofaces/tags/AuthenticatedTag.java | 4 +-
.../muehlencord/shirofaces/tags/GuestTag.java | 4 +-
.../shirofaces/tags/HasAnyPermissionTag.java | 4 +-
.../shirofaces/tags/HasAnyRolesTag.java | 4 +-
.../shirofaces/tags/HasPermissionTag.java | 4 +-
.../shirofaces/tags/HasRoleTag.java | 4 +-
.../shirofaces/tags/LacksPermissionTag.java | 4 +-
.../shirofaces/tags/LacksRoleTag.java | 4 +-
.../shirofaces/tags/NotAuthenticatedTag.java | 4 +-
.../muehlencord/shirofaces/tags/UserTag.java | 4 +-
.../tags/unsupported/PrincipalTag.java | 4 +-
.../resources/META-INF/shiro-faces.taglib.xml | 3 +-
util/pom.xml | 15 +
321 files changed, 2273 insertions(+), 12165 deletions(-)
delete mode 100644 account-dao/pom.xml
delete mode 100644 account-dao/src/main/java/de/muehlencord/shared/account/dao/ApiKeyObject.java
delete mode 100644 account-dao/src/main/java/de/muehlencord/shared/account/dao/ApiKeyUtil.java
delete mode 100644 account-dao/src/main/java/de/muehlencord/shared/account/dao/JacksonConfig.java
delete mode 100644 account-dao/src/test/java/de/muehlencord/shared/account/dao/ApiKeyObjectTest.java
delete mode 100644 account-ui/faces-config.NavData
delete mode 100644 account-ui/nb-configuration.xml
delete mode 100644 account-ui/pom.xml
delete mode 100644 account-ui/src/main/filters/development.properties
delete mode 100644 account-ui/src/main/filters/production.properties
delete mode 100644 account-ui/src/main/java/de/muehlencord/shared/account/web/EnsurePermissionsBean.java
delete mode 100644 account-ui/src/main/java/de/muehlencord/shared/account/web/FacesContextProducer.java
delete mode 100644 account-ui/src/main/java/de/muehlencord/shared/account/web/PermissionConstants.java
delete mode 100644 account-ui/src/main/java/de/muehlencord/shared/account/web/PersistenceContextFactory.java
delete mode 100644 account-ui/src/main/java/de/muehlencord/shared/account/web/ResourceBundleProducer.java
delete mode 100644 account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/AccountView.java
delete mode 100644 account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/ApplicationView.java
delete mode 100644 account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/InstanceView.java
delete mode 100644 account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/PermissionView.java
delete mode 100644 account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/RoleView.java
delete mode 100644 account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/UniqueApplicationRoleNameValidator.java
delete mode 100644 account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/UniqueApplicationValidator.java
delete mode 100644 account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/UniquePermissionNameValidator.java
delete mode 100644 account-ui/src/main/resources/META-INF/persistence.xml
delete mode 100644 account-ui/src/main/resources/admin-config.properties
delete mode 100644 account-ui/src/main/resources/buildInfo.properties
delete mode 100644 account-ui/src/main/resources/de/muehlencord/shared/account/web/presentation/messages.properties
delete mode 100644 account-ui/src/main/resources/de/muehlencord/shared/account/web/presentation/messages_de.properties
delete mode 100644 account-ui/src/main/resources/de/muehlencord/shared/account/web/presentation/messages_en.properties
delete mode 100644 account-ui/src/main/webapp/WEB-INF/beans.xml
delete mode 100644 account-ui/src/main/webapp/WEB-INF/faces-config.xml
delete mode 100644 account-ui/src/main/webapp/WEB-INF/jboss-web.xml
delete mode 100644 account-ui/src/main/webapp/WEB-INF/shiro.ini
delete mode 100644 account-ui/src/main/webapp/WEB-INF/web.xml
delete mode 100644 account-ui/src/main/webapp/index.xhtml
delete mode 100644 account-ui/src/main/webapp/login.xhtml
delete mode 100644 account-ui/src/main/webapp/logout.xhtml
delete mode 100644 account-ui/src/main/webapp/resources/composite/confirmationDialog.xhtml
delete mode 100644 account-ui/src/main/webapp/resources/css/admin.css
delete mode 100644 account-ui/src/main/webapp/resources/template/footer.xhtml
delete mode 100644 account-ui/src/main/webapp/resources/template/leftmenu.xhtml
delete mode 100644 account-ui/src/main/webapp/resources/template/template.xhtml
delete mode 100644 account-ui/src/main/webapp/web/accounts.xhtml
delete mode 100644 account-ui/src/main/webapp/web/applications.xhtml
delete mode 100644 account-ui/src/main/webapp/web/index.xhtml
delete mode 100644 account-ui/src/main/webapp/web/permissions.xhtml
delete mode 100644 account-ui/src/main/webapp/web/roles.xhtml
delete mode 100644 account/pom.xml
delete mode 100644 account/sql/account.dbm
delete mode 100644 account/sql/account.sql
delete mode 100644 account/sql/account_prefill.sql
delete mode 100644 account/sql/backupAccount.bat
delete mode 100644 account/sql/backupAccountTest.bat
delete mode 100644 account/sql/createDatabaseFileFromDBM.bat
delete mode 100644 account/sql/drop_all_tables.sql
delete mode 100644 account/sql/restoreAccount.bat
delete mode 100644 account/sql/restoreAccountTest.bat
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/account/boundary/AccountPermissions.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/account/boundary/AccountProducer.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/account/boundary/ApiKeyError.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/account/boundary/ApiKeyException.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/account/boundary/ApiKeyService.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/account/control/AccountControl.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/account/entity/Account.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountConfigurationKey.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountConfigurationValue.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountEntity.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountException.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountHistoryEntity.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountLoginEntity.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountStatus.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/account/entity/ApiKeyEntity.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/account/entity/JWTObject.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/application/boundary/ApplicationError.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/application/control/ApplicationControl.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/application/control/ApplicationPermissionControl.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/application/control/ApplicationRoleControl.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/application/entity/ApplicationEntity.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/application/entity/ApplicationPermissionEntity.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/application/entity/ApplicationRoleEntity.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/config/boundary/ConfigService.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/config/boundary/ConfigurationProducer.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/config/entity/ConfigEntity.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/config/entity/ConfigEntityPK.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/config/entity/ConfigException.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/instance/boundary/ApplicationPermissions.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/instance/boundary/StartupBean.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/instance/control/ApplicationController.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/mail/boundary/MailService.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/mail/boundary/MailTemplateService.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/mail/entity/MailDatamodel.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/mail/entity/MailException.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/mail/entity/MailTemplateEntity.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/business/mail/entity/MailTemplateException.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/presentation/LoginView.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/presentation/LostPasswordView.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/shiro/authc/JwtMatcher.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/shiro/filter/JWTAuthenticationFilter.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/shiro/pam/AllSupportedSuccessfulStrategy.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/shiro/realm/AccountRealm.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/shiro/realm/UserNameActiveDirectoryRealm.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/shiro/token/JWTAuthenticationToken.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/util/AccountPU.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/util/AccountSecurityException.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/util/AccountSecurityExceptionMapper.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/util/AccountTransactionJoinInterceptor.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/util/Permission.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/util/SecurityError.java
delete mode 100644 account/src/main/java/de/muehlencord/shared/account/util/SecurityUtil.java
delete mode 100644 account/src/main/resources/META-INF/persistence.xml
delete mode 100644 account/src/main/resources/de/muehlencord/shared/account/business/account/boundary/ApiKeyError.properties
delete mode 100644 account/src/main/resources/de/muehlencord/shared/account/business/account/boundary/ApiKeyError_de_DE.properties
delete mode 100644 account/src/main/resources/de/muehlencord/shared/account/business/account/boundary/ApiKeyError_en_US.properties
delete mode 100644 account/src/main/resources/de/muehlencord/shared/account/business/application/boundary/ApplicationServiceError.properties
delete mode 100644 account/src/main/resources/de/muehlencord/shared/account/business/application/boundary/ApplicationServiceError_de_DE.properties
delete mode 100644 account/src/main/resources/de/muehlencord/shared/account/business/application/boundary/ApplicationServiceError_en_US.properties
delete mode 100644 account/src/test/java/de/muehlencord/shared/account/business/account/boundary/ApiKeyServiceTest.java
delete mode 100644 account/src/test/java/de/muehlencord/shared/account/business/config/boundary/ConfigServiceTest.java
delete mode 100644 account/src/test/java/de/muehlencord/shared/account/shiro/realm/UserNameActiveDirectoryRealmTest.java
delete mode 100644 account/src/test/java/de/muehlencord/shared/account/util/SecurityUtilTest.java
delete mode 100644 account/src/test/resources/log4j.xml
delete mode 100644 account/src/test/resources/shiro.ini
delete mode 100644 account/src/test/resources/shiro.ini.dist
delete mode 100644 security/pom.xml
delete mode 100644 security/src/main/java/de/muehlencord/shared/security/Luhn.java
delete mode 100644 security/src/main/java/de/muehlencord/shared/security/OldPasswordUtil.java
delete mode 100644 security/src/main/java/de/muehlencord/shared/security/PasswordUtil.java
delete mode 100644 security/src/main/java/de/muehlencord/shared/security/SecurityException.java
delete mode 100644 security/src/test/java/de/muehlencord/shared/security/LuhnTest.java
delete mode 100644 security/src/test/java/de/muehlencord/shared/security/OldPasswordUtilTest.java
delete mode 100644 security/src/test/java/de/muehlencord/shared/security/PasswordUtilTest.java
diff --git a/.gitignore b/.gitignore
index 3298416..53f619e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,183 @@
-/**/.settings/
-**/target/
-.classpath
-.project
-**/nbproject/
-*.dump
-**/_dump
+# ---> NetBeans
+nbproject/private/
+build/
+nbbuild/
+dist/
+nbdist/
+nbactions.xml
**/nb-configuration.xml
+.nb-gradle/
+
+# ---> Eclipse
+.project
+.settings/
+.classpath
+
+# ---> Maven
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+
+# ---> Java
+*.class
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.ear
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+# ---> TeX
+## Core latex/pdflatex auxiliary files:
+*.aux
+*.lof
+*.log
+*.lot
+*.fls
+*.out
+*.toc
+
+## Intermediate documents:
+*.dvi
+*-converted-to.*
+# these rules might exclude image files for figures etc.
+# *.ps
+# *.eps
+# *.pdf
+
+## Bibliography auxiliary files (bibtex/biblatex/biber):
+*.bbl
+*.bcf
+*.blg
+*-blx.aux
+*-blx.bib
+*.brf
+*.run.xml
+
+## Build tool auxiliary files:
+*.fdb_latexmk
+*.synctex
+*.synctex.gz
+*.synctex.gz(busy)
+*.pdfsync
+
+## Auxiliary and intermediate files from other packages:
+
+
+# algorithms
+*.alg
+*.loa
+
+# achemso
+acs-*.bib
+
+# amsthm
+*.thm
+
+# beamer
+*.nav
+*.snm
+*.vrb
+
+#(e)ledmac/(e)ledpar
+*.end
+*.[1-9]
+*.[1-9][0-9]
+*.[1-9][0-9][0-9]
+*.[1-9]R
+*.[1-9][0-9]R
+*.[1-9][0-9][0-9]R
+*.eledsec[1-9]
+*.eledsec[1-9]R
+*.eledsec[1-9][0-9]
+*.eledsec[1-9][0-9]R
+*.eledsec[1-9][0-9][0-9]
+*.eledsec[1-9][0-9][0-9]R
+
+# glossaries
+*.acn
+*.acr
+*.glg
+*.glo
+*.gls
+
+# gnuplottex
+*-gnuplottex-*
+
+# hyperref
+*.brf
+
+# knitr
+*-concordance.tex
+*.tikz
+*-tikzDictionary
+
+# listings
+*.lol
+
+# makeidx
+*.idx
+*.ilg
+*.ind
+*.ist
+
+# minitoc
+*.maf
+*.mtc
+*.mtc[0-9]
+*.mtc[1-9][0-9]
+
+# minted
+_minted*
+*.pyg
+
+# morewrites
+*.mw
+
+# mylatexformat
+*.fmt
+
+# nomencl
+*.nlo
+
+# sagetex
+*.sagetex.sage
+*.sagetex.py
+*.sagetex.scmd
+
+# sympy
+*.sout
+*.sympy
+sympy-plots-for-*.tex/
+
+# TikZ & PGF
+*.dpth
+*.md5
+*.auxlock
+
+# todonotes
+*.tdo
+
+# xindy
+*.xdy
+
+# WinEdt
+*.bak
+*.sav
+
+# localized versions of JBOSS command line interface
+*.local.cli
+/source/office-parent/office-web/faces-config.NavData
+/source/vvh-access-import/src/main/resources/hibernate.cfg.xml
+/source/office-parent/office-entities/src/main/resources/META-INF/persistence.xml
diff --git a/account-dao/pom.xml b/account-dao/pom.xml
deleted file mode 100644
index 0cced5a..0000000
--- a/account-dao/pom.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
- 4.0.0
-
- de.muehlencord
- shared
- 1.2-SNAPSHOT
-
-
- de.muehlencord.shared
- shared-account-dao
- jar
-
- shared-account-dao
-
-
-
-
- com.google.code.gson
- gson
-
-
- com.fasterxml.jackson.core
- jackson-annotations
-
-
- com.fasterxml.jackson.core
- jackson-databind
-
-
- de.muehlencord.shared
- shared-util
-
-
- org.junit.jupiter
- junit-jupiter-api
- 5.3.1
- test
-
-
- org.junit.jupiter
- junit-jupiter-params
- 5.3.1
- test
-
-
- org.junit.jupiter
- junit-jupiter-engine
- 5.3.1
- test
-
-
-
\ No newline at end of file
diff --git a/account-dao/src/main/java/de/muehlencord/shared/account/dao/ApiKeyObject.java b/account-dao/src/main/java/de/muehlencord/shared/account/dao/ApiKeyObject.java
deleted file mode 100644
index 9089648..0000000
--- a/account-dao/src/main/java/de/muehlencord/shared/account/dao/ApiKeyObject.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.dao;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.google.gson.annotations.Expose;
-import java.io.Serializable;
-import java.util.Date;
-import java.util.Objects;
-
-/**
- *
- * @author Joern Muehlencord
- */
-public class ApiKeyObject implements Serializable {
-
- @Expose
- private String userName;
- @Expose
- @JsonFormat(shape = JsonFormat.Shape.STRING, locale = "en_US", timezone = "UTC", pattern = "yyyy-MM-dd'T'HH:mm:ss'Z'")
- private Date issuedOn;
- @Expose
- @JsonFormat(shape = JsonFormat.Shape.STRING, locale = "en_US", timezone = "UTC", pattern = "yyyy-MM-dd'T'HH:mm:ss'Z'")
- private Date expiresOn;
- @Expose
- private String authToken;
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public Date getIssuedOn() {
- return issuedOn;
- }
-
- public void setIssuedOn(Date issuedOn) {
- this.issuedOn = issuedOn;
- }
-
- public Date getExpiresOn() {
- return expiresOn;
- }
-
- public void setExpiresOn(Date expiresOn) {
- this.expiresOn = expiresOn;
- }
-
- public String getAuthToken() {
- return authToken;
- }
-
- public void setAuthToken(String authToken) {
- this.authToken = authToken;
- }
-
- @Override
- public int hashCode() {
- int hash = 3;
- hash = 53 * hash + Objects.hashCode(this.userName);
- hash = 53 * hash + Objects.hashCode(this.issuedOn);
- hash = 53 * hash + Objects.hashCode(this.expiresOn);
- hash = 53 * hash + Objects.hashCode(this.authToken);
- return hash;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final ApiKeyObject other = (ApiKeyObject) obj;
- if (!Objects.equals(this.userName, other.userName)) {
- return false;
- }
- if (!Objects.equals(this.authToken, other.authToken)) {
- return false;
- }
- return true;
- }
-
-}
diff --git a/account-dao/src/main/java/de/muehlencord/shared/account/dao/ApiKeyUtil.java b/account-dao/src/main/java/de/muehlencord/shared/account/dao/ApiKeyUtil.java
deleted file mode 100644
index e33dbac..0000000
--- a/account-dao/src/main/java/de/muehlencord/shared/account/dao/ApiKeyUtil.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2019 Joern Muehlencord .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.dao;
-
-import de.muehlencord.shared.util.DateUtil;
-import java.util.Date;
-
-/**
- *
- * @author Joern Muehlencord
- */
-public abstract class ApiKeyUtil {
-
- private ApiKeyUtil() {
- // hide constructor for abstract class - only static methods are used
- }
-
- public static boolean isValid(ApiKeyObject apiKeyObject) {
- if (apiKeyObject == null) {
- return false;
- }
- Date validToDate = apiKeyObject.getExpiresOn();
- if (validToDate == null) {
- return false;
- }
- Date now = DateUtil.getCurrentTimeInUTC();
- return validToDate.after(now);
- }
-
-}
diff --git a/account-dao/src/main/java/de/muehlencord/shared/account/dao/JacksonConfig.java b/account-dao/src/main/java/de/muehlencord/shared/account/dao/JacksonConfig.java
deleted file mode 100644
index 4e70682..0000000
--- a/account-dao/src/main/java/de/muehlencord/shared/account/dao/JacksonConfig.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package de.muehlencord.shared.account.dao;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import java.text.SimpleDateFormat;
-
-/**
- *
- * @author joern.muehlencord
- */
-public abstract class JacksonConfig {
-
- private static ObjectMapper objectMapper = null;
-
- private JacksonConfig() {
- // hide public constructor for static only class
- }
-
- public static ObjectMapper getInstance() {
- if (objectMapper == null) {
- objectMapper = new ObjectMapper();
- objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"));
- objectMapper.configure(SerializationFeature.INDENT_OUTPUT, true);
- objectMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
- objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
- }
- return objectMapper;
- }
-
-}
diff --git a/account-dao/src/test/java/de/muehlencord/shared/account/dao/ApiKeyObjectTest.java b/account-dao/src/test/java/de/muehlencord/shared/account/dao/ApiKeyObjectTest.java
deleted file mode 100644
index 2756c5d..0000000
--- a/account-dao/src/test/java/de/muehlencord/shared/account/dao/ApiKeyObjectTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package de.muehlencord.shared.account.dao;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import java.io.IOException;
-import java.util.Date;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.jupiter.api.Test;
-
-/**
- *
- * @author Joern Muehlencord
- */
-public class ApiKeyObjectTest {
-
-
-
- @Test
- public void testJackson() throws JsonProcessingException, IOException {
- ApiKeyObject apiKeyObject = new ApiKeyObject();
- apiKeyObject.setUserName("web");
- apiKeyObject.setIssuedOn(new Date());
- apiKeyObject.setExpiresOn(new Date());
-
- ObjectMapper mapper = new ObjectMapper();
- String json = mapper.writeValueAsString(apiKeyObject);
-
- System.out.println(json);
-
-
- ApiKeyObject apiKeyObject2 = mapper.readValue (json, ApiKeyObject.class);
- assertTrue (apiKeyObject.equals(apiKeyObject2));
-
- }
-
-}
diff --git a/account-ui/faces-config.NavData b/account-ui/faces-config.NavData
deleted file mode 100644
index 298bfc5..0000000
--- a/account-ui/faces-config.NavData
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/account-ui/nb-configuration.xml b/account-ui/nb-configuration.xml
deleted file mode 100644
index 5402a7c..0000000
--- a/account-ui/nb-configuration.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
- Facelets
- WildFly
- apache20
- js/libs
-
-
diff --git a/account-ui/pom.xml b/account-ui/pom.xml
deleted file mode 100644
index ed320df..0000000
--- a/account-ui/pom.xml
+++ /dev/null
@@ -1,152 +0,0 @@
-
-
- 4.0.0
-
- shared
- de.muehlencord
- 1.2-SNAPSHOT
-
-
- de.muehlencord.shared
- shared-account-ui
- war
-
- shared-account-ui
-
-
- UTF-8
- ${maven.build.timestamp}
-
- 143a2bd3-7e0b-4162-a76e-3031331c7dfe
- development
-
-
-
-
- org.primefaces
- primefaces
-
-
-
- com.github.adminfaces
- admin-template
-
-
-
- org.omnifaces
- omnifaces
-
-
-
- org.apache.shiro
- shiro-core
-
-
- org.slf4j
- slf4j-api
-
-
- commons-collections
- commons-collections
-
-
-
-
- org.apache.shiro
- shiro-web
-
-
- de.muehlencord.shared
- shared-shiro-faces
-
-
- de.muehlencord.shared
- shared-account
- ejb
-
-
- de.muehlencord.shared
- shared-util
-
-
- de.muehlencord.shared
- shared-jeeutil
-
-
- de.muehlencord.sf
- filter
-
-
- javax
- javaee-web-api
- provided
-
-
- org.slf4j
- slf4j-api
- provided
-
-
-
-
-
- ${basedir}/src/main/filters/${filter.name}.properties
-
-
-
-
-
- src/main/resources
- true
-
- **/*.properties
- **/*.xml
-
-
-
-
- account
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- org.apache.maven.plugins
- maven-war-plugin
- 3.2.2
-
- false
-
-
- ${basedir}/src/main/webapp
- true
-
- WEB-INF/web.xml
- WEB-INF/jboss-web.xml
- WEB-INF/shiro.ini
-
-
-
-
-
-
-
-
-
-
- development
-
- development
-
-
-
-
- production
-
- production
-
-
-
-
diff --git a/account-ui/src/main/filters/development.properties b/account-ui/src/main/filters/development.properties
deleted file mode 100644
index ef4d834..0000000
--- a/account-ui/src/main/filters/development.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-jsf.projectStage=Development
-context.root=account
-
-shiro.contextFactory = # not defined
-shiro.passwordMatcher= passwordMatcher = org.apache.shiro.authc.credential.PasswordMatcher${line.separator}passwordMatcher.passwordService = $passwordService
-shiro.ldapRealm = # not defined
-shiro.authcStrategy = org.apache.shiro.authc.pam.AllSuccessfulStrategy
-shiro.realms = $jdbcRealm
diff --git a/account-ui/src/main/filters/production.properties b/account-ui/src/main/filters/production.properties
deleted file mode 100644
index ec870b7..0000000
--- a/account-ui/src/main/filters/production.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-jsf.projectStage=Production
-context.root=account
-
-ldap.url = ldaps://host:port
-## we will use provided username / password from webapplication
-ldap.user = user
-ldap.password = secret
-ldap.principalSuffix = @primarySuffix
-ldap.fallbackPrincipalSuffixes = @fallback1, @fallback2
-ldap.searchBase = dc=domain,dc=com
-ldap.searchFilter = (&(objectClass=*)(mail={0}))
-
-## NO CHANGES BEHIND THIS LINE REQUIRED
-shiro.contextFactory = contextFactory = org.apache.shiro.realm.ldap.JndiLdapContextFactory${line.separator}contextFactory.url = ${ldap.url}${line.separator}contextFactory.systemUsername = ${ldap.user}${line.separator}contextFactory.systemPassword = ${ldap.password}${line.separator}contextFactory.environment[java.naming.security.protocol] = ssl
-shiro.passwordMatcher= passwordMatcher=org.apache.shiro.authc.credential.AllowAllCredentialsMatcher
-shiro.ldapRealm = ldapRealm = de.muehlencord.shared.account.shiro.realm.UserNameActiveDirectoryRealm${line.separator}ldapRealm.principalSuffix = ${ldap.principalSuffix}${line.separator}ldapRealm.fallbackPrincipalSuffixes = ${ldap.fallbackPrincipalSuffixes}${line.separator}ldapRealm.ldapContextFactory = $contextFactory${line.separator}ldapRealm.searchBase = ${ldap.searchBase}${line.separator}ldapRealm.searchFilter = ${ldap.searchFilter}${line.separator}ldapRealm.permissionsLookupEnabled=false
-shiro.authcStrategy = org.apache.shiro.authc.pam.AllSuccessfulStrategy
-shiro.realms=$jdbcRealm,$ldapRealm
diff --git a/account-ui/src/main/java/de/muehlencord/shared/account/web/EnsurePermissionsBean.java b/account-ui/src/main/java/de/muehlencord/shared/account/web/EnsurePermissionsBean.java
deleted file mode 100644
index c87bad2..0000000
--- a/account-ui/src/main/java/de/muehlencord/shared/account/web/EnsurePermissionsBean.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright 2018 Joern Muehlencord .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.web;
-
-import de.muehlencord.shared.account.business.account.boundary.AccountPermissions;
-import de.muehlencord.shared.account.business.account.entity.AccountException;
-import de.muehlencord.shared.account.business.application.control.ApplicationPermissionControl;
-import de.muehlencord.shared.account.business.application.control.ApplicationRoleControl;
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import de.muehlencord.shared.account.business.instance.boundary.ApplicationPermissions;
-import java.util.Arrays;
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.Initialized;
-import javax.enterprise.event.Observes;
-import javax.inject.Inject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@ApplicationScoped
-public class EnsurePermissionsBean {
-
- @Inject
- ApplicationEntity application;
-
- @Inject
- ApplicationPermissionControl applicationPermissionControl;
-
- @Inject
- ApplicationRoleControl applicationRoleControl;
-
- private static final Logger LOGGER = LoggerFactory.getLogger(EnsurePermissionsBean.class);
-
- public void init(@Observes @Initialized(ApplicationScoped.class) Object init) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Ensure all permissions for {} are available", application.getApplicationName());
- }
- applicationPermissionControl.setupPermissions(Arrays.asList(ApplicationPermissions.values()));
- applicationPermissionControl.setupPermissions(Arrays.asList(AccountPermissions.values()));
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("All permissions added to application", application.getApplicationName());
- }
-
- // all permissions available - ensure permission is assigned to Admin role
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Ensuring Admin role for {} has all permissions", application.getApplicationName());
- }
- try {
- applicationRoleControl.setupRolePermission(Arrays.asList(ApplicationPermissions.values()), "Admin"); // NOI18N
- applicationRoleControl.setupRolePermission(Arrays.asList(AccountPermissions.values()), "Admin"); // NOI18N
- } catch (AccountException ex) {
- LOGGER.error("Error adding permission to Admin role. Reason={}", ex.getMessage());
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Detailed stacktrace", new Object[]{ex});
- }
-
- }
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("All permissions added to Admin role of {}", application.getApplicationName());
- }
-
- }
-
-}
diff --git a/account-ui/src/main/java/de/muehlencord/shared/account/web/FacesContextProducer.java b/account-ui/src/main/java/de/muehlencord/shared/account/web/FacesContextProducer.java
deleted file mode 100644
index 5a2b950..0000000
--- a/account-ui/src/main/java/de/muehlencord/shared/account/web/FacesContextProducer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2017 Joern Muehlencord .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.web;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.ContextNotActiveException;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.Produces;
-import javax.faces.context.FacesContext;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@ApplicationScoped
-public class FacesContextProducer {
-
- @Produces
- @RequestScoped
- public FacesContext getFacesContext() {
- FacesContext ctx = FacesContext.getCurrentInstance();
- if (ctx == null) {
- throw new ContextNotActiveException("FacesContext is not active");
- }
- return ctx;
- }
-}
diff --git a/account-ui/src/main/java/de/muehlencord/shared/account/web/PermissionConstants.java b/account-ui/src/main/java/de/muehlencord/shared/account/web/PermissionConstants.java
deleted file mode 100644
index ad22306..0000000
--- a/account-ui/src/main/java/de/muehlencord/shared/account/web/PermissionConstants.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2018 Joern Muehlencord .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.web;
-
-import de.muehlencord.shared.account.business.instance.boundary.ApplicationPermissions;
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Named;
-
-/**
- * TODO replace with omnifaces:importConstants currently problems with Netbeans
- * to import omnifaces taglib
- *
- * @author Joern Muehlencord
- */
-@Named(value = "permissionConstants")
-@ApplicationScoped
-public class PermissionConstants {
-
- public String getApplicationListAll() {
- return ApplicationPermissions.APP_LIST.getName();
- }
-
- public String getPermissionsCombined() {
- return ApplicationPermissions.PERMISSION_ADD.getName() + ","
- + ApplicationPermissions.PERMISSION_EDIT.getName() + ","
- + ApplicationPermissions.PERMISSION_DELETE.getName();
- }
-
- public String getRolesCombined() {
- return ApplicationPermissions.ROLE_ADD.getName() + ","
- + ApplicationPermissions.ROLE_EDIT.getName() + ","
- + ApplicationPermissions.ROLE_DELETE.getName();
- }
-
- public String getAccountsCombined() {
- return ApplicationPermissions.ACCOUNT_ADD.getName() + ","
- + ApplicationPermissions.ACCOUNT_DELETE.getName() + ","
- + ApplicationPermissions.ACCOUNT_EDIT.getName() + ","
- + ApplicationPermissions.ACCOUNT_LIST.getName() + ","
- + ApplicationPermissions.ACCOUNT_LOGIN_ADD.getName() + ","
- + ApplicationPermissions.ACCOUNT_LOGIN_DELETE.getName() + ","
- + ApplicationPermissions.ACCOUNT_LOGIN_EDIT.getName();
- }
-
- public String getAccountAdd() {
- return ApplicationPermissions.ACCOUNT_ADD.getName();
- }
-
- public String getAccountDelete() {
- return ApplicationPermissions.ACCOUNT_DELETE.getName();
- }
-
- public String getAccountEdit() {
- return ApplicationPermissions.ACCOUNT_EDIT.getName();
- }
-
- public String getAccountList() {
- return ApplicationPermissions.ACCOUNT_LIST.getName();
- }
-
- public String getAccountLoginAdd() {
- return ApplicationPermissions.ACCOUNT_LOGIN_ADD.getName();
- }
-
- public String getAccountLoginDelete() {
- return ApplicationPermissions.ACCOUNT_LOGIN_DELETE.getName();
- }
-
- public String getAccountLoginEdit() {
- return ApplicationPermissions.ACCOUNT_LOGIN_EDIT.getName();
- }
-
-}
diff --git a/account-ui/src/main/java/de/muehlencord/shared/account/web/PersistenceContextFactory.java b/account-ui/src/main/java/de/muehlencord/shared/account/web/PersistenceContextFactory.java
deleted file mode 100644
index 64fb739..0000000
--- a/account-ui/src/main/java/de/muehlencord/shared/account/web/PersistenceContextFactory.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package de.muehlencord.shared.account.web;
-
-import de.muehlencord.shared.account.util.AccountPU;
-import de.muehlencord.shared.db.ApplicationPU;
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.Disposes;
-import javax.enterprise.inject.Produces;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.PersistenceUnit;
-import javax.persistence.SynchronizationType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@ApplicationScoped
-public class PersistenceContextFactory {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(PersistenceContextFactory.class);
-
- // need to define 2nd database as TransactionJoinInterceptor requires it
- // account UI is the only application where application and account is the same database
- // account UI does not call this as it references all database access via accountPu
- @PersistenceUnit (unitName = "accountPu")
- EntityManagerFactory entityManagerFactory;
-
-
- @Produces
- @RequestScoped
- @ApplicationPU
- public EntityManager getPcdEntityManager() {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("getting entityManager for application");
- }
- EntityManager em = entityManagerFactory.createEntityManager(SynchronizationType.UNSYNCHRONIZED);
- return em;
- }
-
- public void closePcdEntityManager (@Disposes @ApplicationPU EntityManager em) {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("closing entityManager application database");
- }
- em.close();
- }
-
-
- @Produces
- @RequestScoped
- @AccountPU
- public EntityManager getAccountEntityManager() {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("getting entityManager for account database");
- }
- EntityManager em = entityManagerFactory.createEntityManager(SynchronizationType.UNSYNCHRONIZED);
- return em;
- }
-
- public void closeAccountEntityManager (@Disposes @AccountPU EntityManager em) {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("closing entityManager for account database");
- }
- em.close();
- }
-
-}
diff --git a/account-ui/src/main/java/de/muehlencord/shared/account/web/ResourceBundleProducer.java b/account-ui/src/main/java/de/muehlencord/shared/account/web/ResourceBundleProducer.java
deleted file mode 100644
index fc96859..0000000
--- a/account-ui/src/main/java/de/muehlencord/shared/account/web/ResourceBundleProducer.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2017 Joern Muehlencord .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.web;
-
-import java.io.Serializable;
-import java.util.Locale;
-import java.util.ResourceBundle;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.Produces;
-import javax.faces.context.FacesContext;
-import javax.inject.Inject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@RequestScoped
-public class ResourceBundleProducer implements Serializable {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ResourceBundleProducer.class);
-
- private static final long serialVersionUID = 3764096270387408239L;
-
- @Inject
- private Locale locale;
-
- @Inject
- private FacesContext facesContext;
-
- @Produces
- public ResourceBundle getResourceBundle() {
- ResourceBundle rb = ResourceBundle.getBundle("de.muehlencord.shared.account.web.presentation.messages", facesContext.getViewRoot().getLocale());
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("ResourceBundle = "+rb);
- }
- return rb;
- }
-}
diff --git a/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/AccountView.java b/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/AccountView.java
deleted file mode 100644
index b6f03fa..0000000
--- a/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/AccountView.java
+++ /dev/null
@@ -1,296 +0,0 @@
-package de.muehlencord.shared.account.web.presentation;
-
-import de.muehlencord.shared.account.business.account.control.AccountControl;
-import de.muehlencord.shared.account.business.account.entity.AccountEntity;
-import de.muehlencord.shared.account.business.account.entity.AccountException;
-import de.muehlencord.shared.account.business.account.entity.AccountLoginEntity;
-import de.muehlencord.shared.account.business.account.entity.AccountStatus;
-import de.muehlencord.shared.account.business.application.control.ApplicationRoleControl;
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import de.muehlencord.shared.account.business.application.entity.ApplicationRoleEntity;
-import de.muehlencord.shared.jeeutil.FacesUtil;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import javax.ejb.EJB;
-import javax.faces.component.UIInput;
-import javax.faces.context.FacesContext;
-import javax.faces.view.ViewScoped;
-import javax.inject.Inject;
-import javax.inject.Named;
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.subject.Subject;
-import org.primefaces.event.SelectEvent;
-import org.primefaces.event.UnselectEvent;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author jomu
- */
-@ViewScoped
-@Named("accountView")
-public class AccountView implements Serializable {
-
- private static final long serialVersionUID = -8050582392249849438L;
- private static final Logger LOGGER = LoggerFactory.getLogger(AccountView.class);
-
- @Inject
- private ApplicationView applicationView;
- @EJB
- private AccountControl accountService;
- @EJB
- private ApplicationRoleControl appliationRoleService;
-
- /**
- * boolean flag to determine wether disabled accounts should be shown
- * accounts are not deleted but disabled and can be activated in case
- */
- private boolean showDisabledAccounts = false;
-
- // cached accounts
- private List accountList = null;
- // cached application roles
- private List applicationRoles = null;
-
- // account currently on edit
- private AccountEntity currentAccount;
- private List currentAccountRoles = null;
- private AccountLoginEntity currentAccountLogin;
- private String password = null;
- private String repeatPassword = null;
-
- public List getAccounts() {
- if (accountList == null) {
- accountList = accountService.getAllAccounts(showDisabledAccounts);
- }
- return accountList;
- }
-
- public List getAllApplicationRoles() {
- if (applicationRoles == null) {
- ApplicationEntity application = applicationView.getCurrentApplication();
- applicationRoles = appliationRoleService.getAllRoles(application);
- }
- return applicationRoles;
- }
-
- public void selectAccount(SelectEvent event) {
- // nothing to do, currentAccountRoles are loaded before dialog is shown
- }
-
- public void unselectAccount(UnselectEvent event) {
- applicationRoles = null;
- currentAccountRoles = null;
- }
-
- public boolean getAccountSelected() {
- return currentAccount != null;
- }
-
- public void newAccount() {
- currentAccount = new AccountEntity();
- currentAccount.setStatus("NEW"); // TODO add status enum
- currentAccountRoles = new ArrayList<>();
- }
-
- public void editAccount() {
- // function called by webpage
- if (currentAccount == null) {
- currentAccountRoles = null;
- } else {
- currentAccount = accountService.getAccountEntity(currentAccount.getUsername(), true);
- this.currentAccountRoles = new ArrayList<>();
- if (currentAccount.getApplicationRoleList() != null) {
- currentAccountRoles.addAll(currentAccount.getApplicationRoleList());
- }
- }
- }
-
- public void cancelEditAccount() {
- currentAccount = null;
- currentAccountRoles = null;
- }
-
- public void saveEditAccount() {
- String username = currentAccount.getUsername();
- AccountEntity existingEntity = accountService.getAccountEntity(username, true);
- // check if it is a new user (createdBy == null) but a user with same name already exists
- if ((currentAccount.getCreatedBy() == null) && (existingEntity != null)) {
- FacesUtil.addErrorMessage("editDialogMessaegs", "Create new account failed", "Account with username " + username + " already exists");
- } else {
- accountService.saveAccount(currentAccount, applicationView.getCurrentApplication(), currentAccountRoles);
- // force accounts to be loaded from database again
- accountList = null;
-
- }
- }
-
- public void deleteAccount() {
- try {
- accountService.deleteAccount(currentAccount);
- accountList.remove(currentAccount);
- FacesUtil.addGlobalInfoMessage("Info", "Account " + currentAccount.getUsername() + " deleted");
- currentAccount = null;
- currentAccountRoles = null;
- } catch (AccountException ex) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Detailed stacktrace", new Object[]{ex});
- }
- FacesUtil.addGlobalErrorMessage("Error deleting account", ex.getMessage());
- }
- }
-
- public void showDisabledAccountsChange() {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("show diabled accounts changed to {}", showDisabledAccounts);
- }
- this.accountList = null;
- }
-
- public List getStatusList() {
- return AccountStatus.getAllStatusNames();
- }
-
- /* **** account login methods **** */
- public boolean validatePasswords(FacesContext context, List components, List values) {
- String currentPassword = components.get(0).getSubmittedValue().toString();
- String currentPasswordRepeat = components.get(1).getSubmittedValue().toString();
-
- if ((currentPassword == null) || (currentPasswordRepeat == null)) {
- return false;
- }
- boolean returnValue = currentPassword.equals(currentPasswordRepeat);
- return returnValue;
- }
-
- public void addAccountLogin() {
- if (currentAccount == null) {
- // TODO add error handling
- } else {
- this.currentAccountLogin = accountService.createLoginWithRandomPassword();
- }
- }
-
- public void editAccountLogin() {
- if (currentAccount == null) {
- // TODO add error handling
- } else {
- this.currentAccountLogin = currentAccount.getAccountLogin();
- }
- }
-
- public void deleteAccountLogin() {
- if (currentAccount == null) {
- // TODO add error handling
- } else {
- accountService.deleteLogin(currentAccount);
- currentAccount.setAccountLogin(null);
- currentAccountLogin = null;
- accountList = null; // force reload
- FacesUtil.addGlobalInfoMessage("Account saved", "Login removed");
- }
-
- }
-
- public void saveEditAccountLogin() {
- // TODO move to account control - to much logic for the view
- if ((currentAccountLogin == null) || (currentAccount == null)) {
- // TODO add error handling
- } else {
-
- // overwrite password if provided
- if ((password != null) && (!password.trim().equals(""))) {
- // password has been specified
- if (password.equals(repeatPassword)) {
- currentAccountLogin.setAccountPassword(accountService.getHashedPassword(password));
- FacesUtil.addGlobalInfoMessage("Info", "Password updated");
- } else {
- // TODO connect to IPRS
- // frontend does validate passwords do match
- // someone is trying to cheat
- }
- }
-
- if (currentAccountLogin.getId() == null) {
- accountService.addLogin(currentAccount, currentAccountLogin);
- currentAccount.setAccountLogin(currentAccountLogin);
- accountList = null; // force reload of accounts
- } else {
- accountService.updateLogin(currentAccountLogin);
- }
- currentAccountLogin = null;
- FacesUtil.addGlobalInfoMessage("Account saved", "Login data updated");
- }
- }
-
- public void cancelEditAccountLogin() {
- this.currentAccountLogin = null;
- }
-
- public boolean getCurrentLoggedInUser() {
- if (currentAccount == null) {
- return false;
- }
-
- Subject currentUser = SecurityUtils.getSubject();
- if (currentUser == null) {
- // TODO - connect to IPRS - how can this method be called if no user is logged in
- return false;
- }
- String currentUserName = currentUser.getPrincipal().toString();
- return currentUserName.equals(currentAccount.getUsername());
- }
-
- /* **** getter / setter **** */
- /**
- * setter for managed property applicationView
- *
- * @param applicationView the applicaton view to inject
- */
- public void setApplicationView(ApplicationView applicationView) {
- this.applicationView = applicationView;
- }
-
- public AccountEntity getCurrentAccount() {
- return currentAccount;
- }
-
- public void setCurrentAccount(AccountEntity currentAccount) {
- this.currentAccount = currentAccount;
- }
-
- public boolean isShowDisabledAccounts() {
- return showDisabledAccounts;
- }
-
- public void setShowDisabledAccounts(boolean showDisabledAccounts) {
- this.showDisabledAccounts = showDisabledAccounts;
- }
-
- public List getCurrentAccountRoles() {
- return currentAccountRoles;
- }
-
- public void setCurrentAccountRoles(List currentAccountRoles) {
- this.currentAccountRoles = currentAccountRoles;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public String getRepeatPassword() {
- return repeatPassword;
- }
-
- public void setRepeatPassword(String repeatPassword) {
- this.repeatPassword = repeatPassword;
- }
-
-}
diff --git a/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/ApplicationView.java b/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/ApplicationView.java
deleted file mode 100644
index 86a1f5b..0000000
--- a/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/ApplicationView.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package de.muehlencord.shared.account.web.presentation;
-
-import de.muehlencord.shared.account.business.application.control.ApplicationControl;
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import de.muehlencord.shared.account.util.AccountSecurityException;
-import de.muehlencord.shared.jeeutil.FacesUtil;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.enterprise.context.SessionScoped;
-import javax.inject.Inject;
-import javax.inject.Named;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@SessionScoped
-@Named("applicationView")
-public class ApplicationView implements Serializable {
-
- private static final long serialVersionUID = -5515249316880163539L;
- private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationView.class);
-
- @Inject
- ApplicationControl applicationService;
-
- @Inject
- InstanceView instanceView;
-
- @Inject
- Locale locale;
-
- private ApplicationEntity currentApplication = null;
- private ApplicationEntity editApplication = null;
- private List applicationList = null;
-
- @PostConstruct
- public void selectDefaultCurrentApplication() {
- // force applications to be loaded from database
- getAllApplications();
- if ((applicationList != null) && (!applicationList.isEmpty())) {
- currentApplication = applicationList.get(0);
- }
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("post construct executed");
- }
- }
-
- @PreDestroy
- public void predestroy() {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Predestroy executed");
- }
-
- }
-
- public List getAllApplications() {
- if (applicationList == null) {
- try {
- applicationList = applicationService.getAllApplications();
-
- // if no role is assigned to user, ensure that at least current application is added
- if ((applicationList == null) || (applicationList.isEmpty())) {
- applicationList = new ArrayList<>();
- applicationList.add(instanceView.getInstanceApplication());
- }
-
- return applicationList;
- } catch (AccountSecurityException ex) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Detailed stacktrace", new Object[]{ex});
- }
- FacesUtil.addGlobalErrorMessage("Error " + ex.getErrorCode(), ex.getLocalizedMessage(locale));
- return new ArrayList<>();
- }
- }
- return applicationList;
- }
-
- public void selectApplication() {
- if (currentApplication != null) {
- LOGGER.info("selected application: {}", currentApplication.getApplicationName());
- FacesUtil.addGlobalInfoMessage("Success", "Selected application " + currentApplication.getApplicationName());
- }
- }
-
- public void startEditApplication() {
- this.editApplication = currentApplication;
- }
-
- public void newApplication() {
- this.editApplication = new ApplicationEntity();
- }
-
- public void cancelEditApplication() {
- this.editApplication = null;
- }
-
- public void saveEditApplication() {
- if (editApplication == null) {
- FacesUtil.addGlobalErrorMessage("Error", "Need to provide data");
- } else if ((editApplication.getApplicationName() == null) || (editApplication.getApplicationName().trim().equals(""))) {
- String hint;
- if (editApplication.getId() == null) {
- hint = "Cannot create application";
- } else {
- hint = "Cannot save application";
- }
- FacesUtil.addGlobalErrorMessage(hint, "Application name must not be empty");
- } else {
- currentApplication = applicationService.createOrUpdate(editApplication);
- // force reload of to update view
- applicationList = null;
- FacesUtil.addGlobalInfoMessage("Info", "Application saved");
- }
- }
-
- public void deleteApplication() {
- if (currentApplication == null) {
- FacesUtil.addGlobalErrorMessage("Error", "Need to provide data");
- } else if (currentApplication.getId() == null) {
- FacesUtil.addGlobalErrorMessage("Error", "Cannot delete non persistent data");
- } else {
- String applicationName = currentApplication.getApplicationName();
- applicationService.delete(currentApplication);
- applicationList = null; // force reload to update view
- currentApplication = null;
- selectDefaultCurrentApplication();
- FacesUtil.addGlobalInfoMessage("Info", "Application " + applicationName + " deleted");
- }
- }
-
- /* *** getter / setter *** */
- public ApplicationEntity getCurrentApplication() {
- return currentApplication;
- }
-
- public void setCurrentApplication(ApplicationEntity currentApplication) {
- this.currentApplication = currentApplication;
- }
-
- public ApplicationEntity getEditApplication() {
- return editApplication;
- }
-
- public void setEditApplication(ApplicationEntity editApplication) {
- this.editApplication = editApplication;
- }
-}
diff --git a/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/InstanceView.java b/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/InstanceView.java
deleted file mode 100644
index 0043097..0000000
--- a/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/InstanceView.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package de.muehlencord.shared.account.web.presentation;
-
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import de.muehlencord.shared.account.business.config.boundary.ConfigService;
-import de.muehlencord.shared.account.business.config.entity.ConfigException;
-import de.muehlencord.shared.account.business.instance.control.ApplicationController;
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.inject.Named;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * TODO - move to shared-account and remove from all applications and archetype
- *
- * @author Joern Muehlencord
- */
-@Named(value = "instanceView")
-@ApplicationScoped
-public class InstanceView {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(InstanceView.class);
-
- @Inject
- ConfigService configService;
-
- @Inject
- ApplicationController applicationController;
-
- public boolean isDevelopmentVersion() {
- String instanceName = getInstanceName();
- return !instanceName.equals("Production");
- }
-
- public String getInstanceName() {
- String instanceName;
- try {
- instanceName = configService.getConfigValue("base.instance");
- } catch (ConfigException ex) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Detailed stacktrace", new Object[]{ex});
- }
- instanceName = "unknown (" + ex.toString() + ")";
- }
- if (instanceName == null) {
- return "unknown";
- } else {
- return instanceName;
- }
- }
-
- public ApplicationEntity getInstanceApplication() {
- return applicationController.getApplication();
- }
-}
diff --git a/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/PermissionView.java b/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/PermissionView.java
deleted file mode 100644
index 8bf2f6b..0000000
--- a/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/PermissionView.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright 2017 Joern Muehlencord .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.web.presentation;
-
-import de.muehlencord.shared.account.business.account.entity.AccountException;
-import de.muehlencord.shared.account.business.application.control.ApplicationPermissionControl;
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import de.muehlencord.shared.account.business.application.entity.ApplicationPermissionEntity;
-import de.muehlencord.shared.jeeutil.FacesUtil;
-import java.io.Serializable;
-import java.util.List;
-import javax.ejb.EJB;
-import javax.faces.view.ViewScoped;
-import javax.inject.Inject;
-import javax.inject.Named;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@ViewScoped
-@Named("permissionView")
-public class PermissionView implements Serializable {
-
- private static final long serialVersionUID = -1469453490360990772L;
- private static final Logger LOGGER = LoggerFactory.getLogger(PermissionView.class);
-
- @Inject
- private ApplicationView applicationView;
-
- @EJB
- ApplicationPermissionControl applicationPermissionService;
- private ApplicationPermissionEntity currentPermission;
-
- public List getAppPermissions() {
- return applicationPermissionService.getApplicationPermissions(applicationView.getCurrentApplication());
- }
-
- public void saveEditPermission() throws AccountException {
- if (currentPermission != null) {
- String newPermissionName = currentPermission.getPermissionName();
- String newPermissionDescription = currentPermission.getPermissionDescription();
- if ((newPermissionName == null) || (newPermissionName.trim().length() == 0)) {
- FacesUtil.addErrorMessage("editDialogMessages", "Error", "Permission name must not be null");
- } else if ((newPermissionDescription == null) || (newPermissionDescription.trim().length() == 0)) {
- FacesUtil.addErrorMessage("editDialogMessages", "Error", "Permission name must not be null");
- } else {
- if (currentPermission.getId() == null) {
- applicationPermissionService.create(applicationView.getCurrentApplication(), newPermissionName, newPermissionDescription);
- FacesUtil.addGlobalInfoMessage("Info", "Permission " + newPermissionName + " created");
- } else {
- applicationPermissionService.update(currentPermission);
- FacesUtil.addGlobalInfoMessage("Info", "Permission " + newPermissionName + " updated");
- }
- }
- }
- }
-
- public ApplicationEntity getCurrentApplication() {
- if (applicationView.getCurrentApplication() == null) {
- return null;
- } else {
- return applicationView.getCurrentApplication();
- }
- }
-
- public void cancelEditPermission() {
- this.currentPermission = null;
- }
-
- public void newPermission() {
- this.currentPermission = new ApplicationPermissionEntity();
- }
-
- public void editPermission() {
- if (currentPermission == null) {
- FacesUtil.addGlobalErrorMessage("Error", "Please select a permission to edit");
- }
- }
-
- public void deletePermission() {
- if (currentPermission == null) {
- FacesUtil.addGlobalErrorMessage("Error", "Please select a permission to edit");
- } else {
- try {
- applicationPermissionService.delete(currentPermission);
- currentPermission = null;
- } catch (AccountException ex) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Detailed stacktrace", new Object[]{ex});
- }
- FacesUtil.addGlobalErrorMessage("Error while deleting permission.", ex.toString());
- }
- }
- }
-
- public boolean getCanEdit() {
- return isPermissionSelected();
- }
-
- public boolean getCanDelete() {
- return isPermissionSelected();
- }
-
- /* *** getter / setter *** */
- /**
- * required setter for managedProperty
- *
- *
- * @param applicationView the injected applicationView
- */
- public void setApplicationView(ApplicationView applicationView) {
- this.applicationView = applicationView;
- }
-
- public ApplicationPermissionEntity getCurrentPermission() {
- return currentPermission;
- }
-
- public void setCurrentPermission(ApplicationPermissionEntity newCurrentPermission) {
- this.currentPermission = newCurrentPermission;
-
- }
-
- public boolean isPermissionSelected() {
- return currentPermission != null;
- }
-}
diff --git a/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/RoleView.java b/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/RoleView.java
deleted file mode 100644
index 601e31d..0000000
--- a/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/RoleView.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright 2017 Joern Muehlencord .
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.web.presentation;
-
-import de.muehlencord.shared.account.business.account.entity.AccountException;
-import de.muehlencord.shared.account.business.application.control.ApplicationRoleControl;
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import de.muehlencord.shared.account.business.application.entity.ApplicationPermissionEntity;
-import de.muehlencord.shared.account.business.application.entity.ApplicationRoleEntity;
-import de.muehlencord.shared.jeeutil.FacesUtil;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import javax.ejb.EJB;
-import javax.faces.view.ViewScoped;
-import javax.inject.Inject;
-import javax.inject.Named;
-import org.primefaces.event.SelectEvent;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@ViewScoped
-@Named("roleView")
-public class RoleView implements Serializable {
-
- private static final long serialVersionUID = 1669321020398119007L;
- private static final Logger LOGGER = LoggerFactory.getLogger(RoleView.class);
-
- @Inject
- private ApplicationView applicationView;
-
- @EJB
- ApplicationRoleControl applicationRoleControl;
-
- private List allRoles = null;
- private List currentRolePermissions = null;
- private List missingApplicationsPermissions = null;
-
- private ApplicationRoleEntity currentRole;
- private ApplicationPermissionEntity currentPermission;
- private ApplicationPermissionEntity newPermission;
-
- public ApplicationEntity getCurrentApplication() {
- return applicationView.getCurrentApplication();
- }
-
- public List getAllRoles() {
- if (allRoles == null) {
- allRoles = applicationRoleControl.getAllRoles(applicationView.getCurrentApplication());
- }
- return allRoles;
- }
-
- public void startNewRole() {
- this.currentRole = new ApplicationRoleEntity(applicationView.getCurrentApplication());
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Created new current role: {}", currentRole.toString());
- }
-
- }
-
- public void cancelEditRole() {
- this.currentRole = null;
- }
-
- public void saveEditRole() {
- if ((currentRole == null) || (currentRole.getRoleName() == null) || (currentRole.getRoleName().trim().length() == 0)) {
- FacesUtil.addGlobalErrorMessage("Error", "Permission name must not be null");
- } else if (currentRole.getId() == null) {
- applicationRoleControl.create(currentRole);
- allRoles = null; // force reload
- FacesUtil.addGlobalInfoMessage("Info", "Role " + currentRole.getRoleName() + " created");
- } else {
- applicationRoleControl.update(currentRole);
- allRoles = null; // force reload
- FacesUtil.addGlobalInfoMessage("Info", "Role " + currentRole.getRoleName() + " updated");
- }
- }
-
- public void deleteRole() {
- if (currentRole == null) {
- FacesUtil.addGlobalErrorMessage("Error", "Please select a permission to edit");
- } else {
- try {
- applicationRoleControl.delete(currentRole);
- allRoles = null; // force reload
- currentRole = null;
- currentRolePermissions = null;
- } catch (AccountException ex) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Detailed stacktrace", new Object[]{ex});
- }
-
- FacesUtil.addGlobalErrorMessage("Error while deleting permission.", ex.toString());
- }
- }
- }
-
- public boolean getRoleSelected() {
- return currentRole != null;
- }
-
- public boolean getPermissionSelected() {
- return currentPermission != null;
- }
-
- public boolean getMissingPermissionAvailable() {
- return ((missingApplicationsPermissions != null) && (!missingApplicationsPermissions.isEmpty()));
- }
-
- public void onRoleSelect(SelectEvent event) {
- currentRolePermissions = null;
- currentRolePermissions = getRolePermissions();
- missingApplicationsPermissions = null;
- missingApplicationsPermissions = getMissingPermissions();
- }
-
- public List getRolePermissions() {
- if (currentRole == null) {
- currentRolePermissions = new ArrayList<>();
- return currentRolePermissions;
- } else {
- if (currentRolePermissions == null) {
- try {
- currentRolePermissions = applicationRoleControl.getRolePermissions(currentRole);
- } catch (AccountException ex) {
- LOGGER.error(ex.getMessage());
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Detailed stacktrace", new Object[]{ex});
- }
-
- FacesUtil.addGlobalErrorMessage("Error while fetching role permissions", "see log for details");
- currentRolePermissions = new ArrayList<>();
- }
- }
- return currentRolePermissions;
- }
- }
-
- public List getMissingPermissions() {
- if (currentRole == null) {
- missingApplicationsPermissions = new ArrayList<>();
- return missingApplicationsPermissions;
- } else {
- if (missingApplicationsPermissions == null) {
- missingApplicationsPermissions = applicationRoleControl.getNotAssignedApplicationPermissions(currentRole);
-
- }
- return missingApplicationsPermissions;
- }
- }
-
- public void addRolePermission() {
- if (newPermission == null) {
- FacesUtil.addGlobalErrorMessage("Error", "Please select a new permission first");
- } else {
- try {
- applicationRoleControl.addPermission(currentRole, newPermission);
- currentRolePermissions = null;
- missingApplicationsPermissions = null;
- } catch (AccountException ex) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Detailed stacktrace", new Object[]{ex});
- }
-
- FacesUtil.addGlobalErrorMessage("Error while adding permission", ex.getMessage());
- }
- }
-
- }
-
- public void removeRolePermission() {
- if (currentPermission == null) {
- FacesUtil.addGlobalErrorMessage("Error", "Please select a permission first");
- } else {
- try {
- applicationRoleControl.removePermission(currentRole, currentPermission);
- currentRolePermissions = null;
- missingApplicationsPermissions = null;
- } catch (AccountException ex) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Detailed stacktrace", new Object[]{ex});
- }
- FacesUtil.addGlobalErrorMessage("Error while adding permission", ex.getMessage());
- }
- }
-
- }
-
- /* *** getter / setter *** */
- public void setApplicationView(ApplicationView applicationView) {
- this.applicationView = applicationView;
- }
-
- public ApplicationRoleEntity getCurrentRole() {
- return currentRole;
- }
-
- public void setCurrentRole(ApplicationRoleEntity currentRole) {
- this.currentRole = currentRole;
- }
-
- public ApplicationPermissionEntity getCurrentPermission() {
- return currentPermission;
- }
-
- public void setCurrentPermission(ApplicationPermissionEntity currentPermission) {
- this.currentPermission = currentPermission;
- }
-
- public ApplicationPermissionEntity getNewPermission() {
- return newPermission;
- }
-
- public void setNewPermission(ApplicationPermissionEntity newPermission) {
- this.newPermission = newPermission;
- }
-
-}
diff --git a/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/UniqueApplicationRoleNameValidator.java b/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/UniqueApplicationRoleNameValidator.java
deleted file mode 100644
index 0f977e9..0000000
--- a/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/UniqueApplicationRoleNameValidator.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package de.muehlencord.shared.account.web.presentation;
-
-import de.muehlencord.shared.account.business.application.control.ApplicationRoleControl;
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import de.muehlencord.shared.account.business.application.entity.ApplicationRoleEntity;
-import de.muehlencord.shared.account.util.AccountPU;
-import java.io.Serializable;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIInput;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.FacesValidator;
-import javax.faces.validator.Validator;
-import javax.faces.validator.ValidatorException;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@FacesValidator("uniqueApplicationRoleNameValidator")
-public class UniqueApplicationRoleNameValidator implements Validator, Serializable {
-
- private static final long serialVersionUID = 8165013107453616719L;
-
- @Inject
- @AccountPU
- EntityManager em;
-
- @Inject
- ApplicationRoleControl applicationRoleControl;
-
- @Override
- public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
-
- Object oldRoleNameObj = ((UIInput) component).getValue();
- String oldRoleName = "";
- if (oldRoleNameObj != null) {
- oldRoleName = oldRoleNameObj.toString();
- }
-
- Object applicationObj = component.getAttributes().get("application");
- if ((applicationObj != null) && (applicationObj instanceof ApplicationEntity)) {
- ApplicationEntity application = (ApplicationEntity) applicationObj;
- if (value == null) {
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Role name invalid", "Role name must not be empty"));
- }
- if (value instanceof String) {
- String roleName = (String) value;
- ApplicationRoleEntity existingRole = applicationRoleControl.findByName(application, roleName);
- if (existingRole != null) {
- if (!oldRoleName.equals(roleName)) {
- // name of role changed and there is another role with the new name already --> this must not happen
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Role name invalid", "Role already exists"));
- }
- }
- } else {
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Role name invalid", "Role name must be a string value"));
- // TODO add IPRS logger - someone is trying to cheat
- }
- } else {
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Application not set", "Permission name cannot be set if application is unknown"));
- }
- }
-
-}
diff --git a/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/UniqueApplicationValidator.java b/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/UniqueApplicationValidator.java
deleted file mode 100644
index ba0870a..0000000
--- a/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/UniqueApplicationValidator.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package de.muehlencord.shared.account.web.presentation;
-
-import de.muehlencord.shared.account.business.application.control.ApplicationControl;
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import java.io.Serializable;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIInput;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.FacesValidator;
-import javax.faces.validator.Validator;
-import javax.faces.validator.ValidatorException;
-import javax.inject.Inject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@FacesValidator("uniqueApplicationValidator")
-public class UniqueApplicationValidator implements Validator, Serializable {
-
- private static final long serialVersionUID = 2526409681909574670L;
- private static final Logger LOGGER = LoggerFactory.getLogger(UniqueApplicationValidator.class);
-
- @Inject
- ApplicationControl applicationService;
-
- @Override
- public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
-
- Object oldAppNameObj = ((UIInput) component).getValue();
- String oldAppName = "";
- if (oldAppNameObj != null) {
- oldAppName = oldAppNameObj.toString();
- }
-
- if (value == null) {
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Application name invalid", "Application name must not be empty"));
- }
- if (value instanceof String) {
- String applicationname = (String) value;
- ApplicationEntity existingApplication = applicationService.findByApplicationName(applicationname);
- if (existingApplication != null) {
- if (!oldAppName.equals(applicationname)) {
- // name of application changed and there is another application with the new
- // name already --> this must not happen
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Application name invalid", "Application already exists"));
- }
- }
- LOGGER.info("Name = {}", applicationname);
- } else {
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Application name invalid", "Application name must be a string value"));
- // TODO add IPRS logger - someone is trying to cheat
- }
-
- }
-
-}
diff --git a/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/UniquePermissionNameValidator.java b/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/UniquePermissionNameValidator.java
deleted file mode 100644
index 177edfe..0000000
--- a/account-ui/src/main/java/de/muehlencord/shared/account/web/presentation/UniquePermissionNameValidator.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package de.muehlencord.shared.account.web.presentation;
-
-import de.muehlencord.shared.account.business.application.control.ApplicationPermissionControl;
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import de.muehlencord.shared.account.business.application.entity.ApplicationPermissionEntity;
-import de.muehlencord.shared.account.util.AccountPU;
-import java.io.Serializable;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIInput;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.FacesValidator;
-import javax.faces.validator.Validator;
-import javax.faces.validator.ValidatorException;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@FacesValidator("uniquePermissionNameValidator")
-public class UniquePermissionNameValidator implements Validator, Serializable {
-
- private static final long serialVersionUID = 2526409681909574670L;
-
- @Inject
- @AccountPU
- EntityManager em;
-
- @Inject
- ApplicationPermissionControl applicationPermissionControl;
-
- @Override
- public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
-
- Object oldPermissionNameObj = ((UIInput) component).getValue();
- String oldPermissionName = "";
- if (oldPermissionNameObj != null) {
- oldPermissionName = oldPermissionNameObj.toString();
- }
-
- Object applicationObj = component.getAttributes().get("application");
- if ((applicationObj != null) && (applicationObj instanceof ApplicationEntity)) {
- ApplicationEntity application = (ApplicationEntity) applicationObj;
- if (value == null) {
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Permission name invalid", "Permission name must not be empty"));
- }
- if (value instanceof String) {
- String permissionName = (String) value;
- ApplicationPermissionEntity existingPermission = applicationPermissionControl.findPermissionByName(application, permissionName);
- if (existingPermission != null) {
- if ((!oldPermissionName.equals (permissionName))) {
- // name of permission changed and there is another permission with the new
- // name already --> this must not happen
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Permission name invalid", "Permission already exists"));
- }
- }
- } else {
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Permission name invalid", "Permission name must be a string value"));
- // TODO add IPRS logger - someone is trying to cheat
- }
- } else {
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Application not set", "Permission name cannot be set if application is unknown"));
- }
- }
-
-}
diff --git a/account-ui/src/main/resources/META-INF/persistence.xml b/account-ui/src/main/resources/META-INF/persistence.xml
deleted file mode 100644
index 7065ea3..0000000
--- a/account-ui/src/main/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
- org.hibernate.ejb.HibernatePersistence
- java:/jboss/accountDs
- de.muehlencord.shared.account.business.account.entity.AccountEntity
- de.muehlencord.shared.account.business.account.entity.AccountHistoryEntity
- de.muehlencord.shared.account.business.account.entity.AccountLoginEntity
- de.muehlencord.shared.account.business.account.entity.ApiKeyEntity
- de.muehlencord.shared.account.business.application.entity.ApplicationEntity
- de.muehlencord.shared.account.business.application.entity.ApplicationPermissionEntity
- de.muehlencord.shared.account.business.application.entity.ApplicationRoleEntity
- de.muehlencord.shared.account.business.config.entity.ConfigEntity
- de.muehlencord.shared.account.business.mail.entity.MailTemplateEntity
- true
- ENABLE_SELECTIVE
- NONE
-
-
-
-
-
-
-
-
diff --git a/account-ui/src/main/resources/admin-config.properties b/account-ui/src/main/resources/admin-config.properties
deleted file mode 100644
index e2bc279..0000000
--- a/account-ui/src/main/resources/admin-config.properties
+++ /dev/null
@@ -1,38 +0,0 @@
-admin.loginPage=login.xhtml
-admin.indexPage=web/index.xhtml
-#admin.dateFormat=
-#admin.breadcrumbSize=5
-admin.renderMessages=true
-admin.renderAjaxStatus=false
-admin.disableFilter=true
-admin.renderBreadCrumb=false
-#admin.extensionLessUrls=false
-#admin.enableSlideMenu=true
-#admin.enableRipple=true
-#admin.rippleMobileOnly=true
-admin.renderMenuSearch=false
-#admin.renderControlSidebar=false
-#admin.controlSidebar.showOnMobile=false
-#admin.controlSidebar.leftMenuTemplate=true
-#admin.controlSidebar.fixedLayout=false
-#admin.controlSidebar.boxedLayout=false
-#admin.controlSidebar.sidebarCollapsed=false
-#admin.controlSidebar.expandOnHover=false
-#admin.controlSidebar.fixed=false
-admin.controlSidebar.darkSkin=false
-admin.autoHideMessages=false
-admin.renderFormAsterisks=true
-#admin.enableMobileHeader=true
-#admin.closableLoading=true
-#admin.messagesHideTimeout=2500
-admin.skin=skin-purple-light
-#admin.autoShowNavbar=true
-#admin.loadingImage=ajaxloadingbar.gif
-#admin.iconsEffect=true
-#admin.rippleElements=.ripplelink,button.ui-button:not([class*=ui-picklist]):not([class*=ui-orderlist]),li.ui-selectlistbox-item,li.ui-multiselectlistbox-item,.ui-selectonemenu-label,.ui-selectcheckboxmenu,\
-# .ui-autocomplete-dropdown, .ui-autocomplete-item, .ui-splitbutton-menubutton, .ui-splitbutton button.ui-button,.input-group, .ui-selectbooleanbutton, \
-# div.ui-button,.ui-chkbox-icon, .ui-link, .form-control, .btn, .ui-sortable-column,.ui-link, .ui-tabs-nav > li,.ui-selectonemenu-trigger, \
-# .ui-accordion-header, .treeview, .sidebar-toggle, .ui-radiobutton-icon, td[role="gridcell"], .ui-selectcheckboxmenu-trigger,.ui-paginator-page, \
-# .ui-panelmenu-header > a, a#layout-setup, .control-sidebar div#restore-defaults > a, .control-sidebar div.ui-selectbooleancheckbox .ui-chkbox, \
-# .control-sidebar span.control-sidebar-subheading > label, .control-sidebar a.skin-link, button.navbar-toggle, li.dropdown > a
-
diff --git a/account-ui/src/main/resources/buildInfo.properties b/account-ui/src/main/resources/buildInfo.properties
deleted file mode 100644
index d0f10ae..0000000
--- a/account-ui/src/main/resources/buildInfo.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-build.version=${project.version}
-build.timestamp=${timestamp}
-application.uuid=${applicationUuid}
\ No newline at end of file
diff --git a/account-ui/src/main/resources/de/muehlencord/shared/account/web/presentation/messages.properties b/account-ui/src/main/resources/de/muehlencord/shared/account/web/presentation/messages.properties
deleted file mode 100644
index 59c98b9..0000000
--- a/account-ui/src/main/resources/de/muehlencord/shared/account/web/presentation/messages.properties
+++ /dev/null
@@ -1,133 +0,0 @@
-header_login=Login
-header_reset_password=Reset password
-message_username_password=Please enter your user name and a new password
-button_login=Login
-button_cancel=Cancel
-button_password_lost=Password lost?
-label_username=Username
-label_password=Password
-label_new_password=New Password
-button_password_reset=Reset password
-header_passwort_lost=Lost password
-message_start_password_reset=Please enter your username to start the password recovery procedure
-menu_dashboard=Dashboard
-menu_events=Events
-menu_administration=Administration
-menu_overview=Overview
-menu_emails=Emails
-menu_account=Account
-menu_config=Config
-menu_logout=Logout
-button_new=New
-button_delete=Delete
-button_edit=Edit
-button_reload=Reload
-label_name=Name
-label_description=Description
-label_event_date=Event Date
-label_reservation=Reservation
-label_reservation_from_to=Reservation from/to
-label_actions=Actions
-message_confirm=Are you sure?
-button_setup=Setup
-button_reservations=Reservations
-label_event_name=Event Name
-label_event_item_desc=Event Item Description
-label_timezone=Timezone
-label_event_start=Event Start
-label_event_end=Event End
-label_reservation_autostart=Reservation start
-label_reservation_autoend=Reservation end
-label_reservation_active=Reservation active
-label_reservation_max_items=Max Items
-label_booking_deadline=Booking deadline
-label_template_validation=Email validation mail template
-label_template_confirmation=Event confirmation mail template
-label_template_waitlist=Event waitlist mail template
-message_event_not_found=Event not found
-label_items=Items
-label_costs=Costs
-label_all=All
-label_yes=Yes
-label_no=No
-label_status=Status
-label_firstname=Firstname
-label_lastname=Lastname
-label_emailaddress=Emailaddress
-label_comment=Comment
-label_email_confirmed=Email confirmed
-label_booking_number=Booking Number
-label_booking_executed=booking executed
-tt_log_entries=Show log entries
-tt_cancel_reservation=Cancel the current reservation
-tt_send_email_again=Send email again
-tt_move_from_wl=Move from waitlist
-tt_fix_reservation=Try to fix the current reservation
-tt_edit_reservation=Edit the reservation
-button_refresh_free=Refresh free
-button_manual_reserve=Reserve
-button_export=Export
-label_amount=Amount
-label_select=Select
-label_created_by=Created by
-label_ip=IP
-label_ip_forwarded=IP (forwarded)
-label_value=Value
-label_useragent=Useragent
-button_ok=Ok
-message_comment=Please add a comment
-menu_help=Help
-label_event=Event
-label_active=Active
-label_waitlist=Waitlist
-label_is_waitlist=Is waitlist
-label_order=Order
-message_dynamic_numbering=dynamic numbering (put %n as placeholder)
-label_start_number=Start Number
-label_end_number=End Number
-header_item_def=Define items for event
-message_no_event_items=No event item defined
-button_overview=Overview
-label_reservation_auto_start=Automatically switch on/off
-label_item_public=Item public?
-label_is_publicitem=Is public
-label_customer_comment=Customer comment
-label_change_comment=Change comment
-label_existing_items=current items
-label_new_items=new items
-label_available_items=available items
-label_no_records=No records found.
-button_mail=Mail
-header_email_distribution=Email distribution
-label_template=Template
-label_demomode=Demo mode
-message_invalid_email=Please provide a valid email address
-menu_permissions=Permissions
-button_save=Save
-menu_groups=Groups
-message_email_sent=email sent
-message_email_with_error=emails with error
-message_no_email=no email address defined
-message_email_not_sent=Error while sending emails
-label_seating=Seating
-label_attachments=Attachments
-label_language=Language
-label_subject=Subject
-label_bytes=Bytes
-label_upload=Upload
-header_export=Export
-label_export_type=Export Type
-label_filtered=Filtered
-label_include_deleted=Include deleted
-label_include_log=Include Logs
-label_template_booking_executed=Booking executed template
-label_street=Street
-label_zipCode=ZIP Code
-label_city=City
-label_groupName=Groupname
-label_phoneNumber=Phone Number
-label_template_waitlist_cancelled=Waitlist cancelled mail template
-msgs_menu_status=Status
-menu_status=Status
-button_add=Add
-passwords_different=Passwords do not match, please check input
diff --git a/account-ui/src/main/resources/de/muehlencord/shared/account/web/presentation/messages_de.properties b/account-ui/src/main/resources/de/muehlencord/shared/account/web/presentation/messages_de.properties
deleted file mode 100644
index a07a382..0000000
--- a/account-ui/src/main/resources/de/muehlencord/shared/account/web/presentation/messages_de.properties
+++ /dev/null
@@ -1,134 +0,0 @@
-
-header_login=Anmeldung
-header_reset_password=Passwort zur\u00fccksetzten
-message_username_password=Bitte geben Deinen Benutzernamen und dein Passwort ein
-button_login=Anmelden
-button_cancel=Abbruch
-button_password_lost=Passwort vergessen?
-label_username=Benutzername
-label_password=Passwort
-label_new_password=Neues Passwort
-button_password_reset=Passwort zur\u00fccksetzten
-header_passwort_lost=Passwort vergessen
-message_start_password_reset=Bitte gib deinen Benutzernamen ein um das Zur\u00fccksetzten des Passworts zu starten.
-menu_dashboard=Dashbaord
-menu_events=Veranstaltungen
-menu_administration=Administration
-menu_overview=\u00dcbersicht
-menu_emails=E-Mails
-menu_account=Benutzer
-menu_config=Konfiguration
-menu_logout=Abmelden
-button_new=Neu
-button_delete=L\u00f6schen
-button_edit=Bearbeiten
-button_reload=Aktualisieren
-label_name=Name
-label_description=Beschreibung
-label_event_date=Veranstaltungsdatum
-label_reservation=Reservierung
-label_reservation_from_to=Reservierung von/bis
-label_actions=Aktionen
-message_confirm=Bist du sicher?
-button_setup=Setup
-button_reservations=Reservierungen
-label_event_name=Veranstaltungsname
-label_event_item_desc=Veranstaltungsobjekte
-label_timezone=Zeitzone
-label_event_start=Veranstaltungsbeginn
-label_event_end=Veranstaltungsende
-label_reservation_autostart=Reservierung von
-label_reservation_autoend=Reservierung bis
-label_reservation_active=Reservierung aktiv
-label_reservation_max_items=Maximale Objekte
-label_booking_deadline=Buchungsfrist
-label_template_validation=Vorlage Emailvalidierung
-label_template_confirmation=Vorlage Reservierungsbest\u00e4tigung
-label_template_waitlist=Vorlage Wartelist
-message_event_not_found=Veranstaltung nicht gefunden
-label_items=Objekte
-label_costs=Kosten
-label_all=Alle
-label_yes=Ja
-label_no=Nein
-label_status=Status
-label_firstname=Vorname
-label_lastname=Nachname
-label_emailaddress=E-Mail-Adresse
-label_comment=Kommentar
-label_email_confirmed=E-Mail best\u00e4tigt
-label_booking_number=Buchungsnummer
-label_booking_executed=Buchungs ausgef\u00fchrt
-tt_log_entries=Logbucheintr\u00e4ge
-tt_cancel_reservation=Storniere die Reservierung
-tt_send_email_again=Sende E-Mail erneut
-tt_move_from_wl=Schiebe von Warteliste
-tt_fix_reservation=Versuche den Fehler zu beheben
-tt_edit_reservation=Bearbeite die Reservierung
-button_refresh_free=Frei aktualisieren
-button_manual_reserve=Reservieren
-button_export=Exportieren
-label_amount=Anzahl
-label_select=W\u00e4hlen
-label_created_by=Erzeugt durch
-label_ip=IP
-label_ip_forwarded=IP (forwarded)
-label_value=Wert
-label_useragent=Useragent
-button_ok=Ok
-message_comment=Bitte geben Sie einen Kommentar an
-menu_help=Hilfe
-label_event=Veranstaltung
-label_active=Aktiv
-label_waitlist=Warteliste
-label_is_waitlist=Ist Warteliste
-label_order=Reihenfolge
-message_dynamic_numbering=Dynamische Nummerierung (%n als Platzhalter)
-label_start_number=Startnummer
-label_end_number=Endnummer
-header_item_def=Objekte f\u00fcr Veranstaltung
-message_no_event_items=Keine Objekte definiert
-button_overview=\u00dcbersicht
-label_reservation_auto_start=Automatisch ein/ausschalten
-label_item_public=\u00d6ffentlich verf\u00fcgar?
-label_is_publicitem=\u00d6ffentlich
-label_customer_comment=Kundenkommentar
-label_change_comment=\u00c4nderungskommentar
-label_existing_items=aktuelle Objekte
-label_new_items=neue Objekte
-label_available_items=verf\u00fcgbare Objekte
-label_no_records=Keine Daten gefunden.
-button_mail=E-Mail
-header_email_distribution=Emailversand
-label_template=Vorlage
-label_demomode=Demomodus
-message_invalid_email=Bitte geben Sie eine g\u00fcltige Emailadresse an
-menu_permissions=Berechtigungen
-button_save=Speichern
-menu_groups=Gruppen
-message_email_sent=Email gesendet
-message_email_with_error=Emails mit Fehler
-message_no_email=keine Emailadresse verf\u00fcgbar
-message_email_not_sent=Fehler beim Versenden der Email
-label_seating=Saalplan Platz
-label_attachments=Attachments
-label_language=Sprache
-label_subject=Betreff
-label_bytes=Bytes
-label_upload=Upload
-header_export=Exportieren
-label_export_type=Export Art
-label_filtered=Gefiltert
-label_include_deleted=Einschlie\u00dflich gel\u00f6scht
-label_include_log=mit Logbuch
-label_template_booking_executed=Vorlage Buchung durchgef\u00fchrt
-label_street=Stra\u00dfe
-label_zipCode=PLZ
-label_city=Ort
-label_groupName=Gruppenname
-label_phoneNumber=Telefonnummer
-label_template_waitlist_cancelled=Vorlage Warteliste Abbruch
-msgs_menu_status=Status
-menu_status=Status
-button_add=Hinzuf\u00fcgen
-passwords_different=Passw\u00f6rter stimmen \u00fcberein, bitte \u00fcberpr\u00fcfen Sie ihre Eingabe
diff --git a/account-ui/src/main/resources/de/muehlencord/shared/account/web/presentation/messages_en.properties b/account-ui/src/main/resources/de/muehlencord/shared/account/web/presentation/messages_en.properties
deleted file mode 100644
index e9f44f4..0000000
--- a/account-ui/src/main/resources/de/muehlencord/shared/account/web/presentation/messages_en.properties
+++ /dev/null
@@ -1,134 +0,0 @@
-
-header_login=Login
-header_reset_password=Reset password
-message_username_password=Please enter your user name and a new password
-button_login=Login
-button_cancel=Cancel
-button_password_lost=Password lost?
-label_username=Username
-label_password=Password
-label_new_password=New Password
-button_password_reset=Reset password
-header_passwort_lost=Lost password
-message_start_password_reset=Please enter your username to start the password recovery procedure
-menu_dashboard=Dashboard
-menu_events=Events
-menu_administration=Administration
-menu_overview=Overview
-menu_emails=Emails
-menu_account=Account
-menu_config=Config
-menu_logout=Logout
-button_new=New
-button_delete=Delete
-button_edit=Edit
-button_reload=Reload
-label_name=Name
-label_description=Description
-label_event_date=Event Date
-label_reservation=Reservation
-label_reservation_from_to=Reservation from/to
-label_actions=Actions
-message_confirm=Are you sure?
-button_setup=Setup
-button_reservations=Reservations
-label_event_name=Event Name
-label_event_item_desc=Event Item Description
-label_timezone=Timezone
-label_event_start=Event Start
-label_event_end=Event End
-label_reservation_autostart=Reservation Start
-label_reservation_autoend=Reservation End
-label_reservation_active=Reservation active
-label_reservation_max_items=Max Items
-label_booking_deadline=Booking deadline
-label_template_validation=Email validation mail template
-label_template_confirmation=Event confirmation mail template
-label_template_waitlist=Event waitlist mail template
-message_event_not_found=Event not found
-label_items=Items
-label_costs=Costs
-label_all=All
-label_yes=Yes
-label_no=No
-label_status=Status
-label_firstname=Firstname
-label_lastname=Lastname
-label_emailaddress=Emailaddress
-label_comment=Comment
-label_email_confirmed=Email confirmed
-label_booking_number=Booking Number
-label_booking_executed=booking executed
-tt_log_entries=Show log entries
-tt_cancel_reservation=Cancel the current reservation
-tt_send_email_again=Send email again
-tt_move_from_wl=Move from waitlist
-tt_fix_reservation=Try to fix the current reservation
-tt_edit_reservation=Edit the reservation
-button_refresh_free=Refresh free
-button_manual_reserve=Reserve
-button_export=Export
-label_amount=Amount
-label_select=Select
-label_created_by=Created by
-label_ip=IP
-label_ip_forwarded=IP (forwarded)
-label_value=Value
-label_useragent=Useragent
-button_ok=Ok
-message_comment=Please add a comment
-menu_help=Help
-label_event=Event
-label_active=Active
-label_waitlist=Waitlist
-label_is_waitlist=Is waitlist
-label_order=Reservation Order
-message_dynamic_numbering=dynamic numbering (put %n as placeholder)
-label_start_number=Start Number
-label_end_number=End Number
-header_item_def=Define items for event
-message_no_event_items=No event item defined
-button_overview=Overview
-label_reservation_auto_start=Automatically switch on/off
-label_item_public=Item public?
-label_is_publicitem=Is public
-label_customer_comment=Customer comment
-label_change_comment=Change comment
-label_existing_items=current items
-label_new_items=new items
-label_available_items=available items
-label_no_records=No records found.
-button_mail=Mail
-header_email_distribution=Email distribution
-label_template=Template
-label_demomode=Demo mode
-message_invalid_email=Please provide a valid email address
-menu_permissions=Permissions
-button_save=Save
-menu_groups=Groups
-message_email_sent=email sent
-message_email_with_error=emails with error
-message_no_email=no email address defined
-message_email_not_sent=Error while sending emails
-label_seating=Seating
-label_attachments=Anh\u00e4nge
-label_language=Language
-label_subject=Subject
-label_bytes=Bytes
-label_upload=Hochladen
-header_export=Export
-label_export_type=Export Type
-label_filtered=Filtered
-label_include_deleted=Include deleted
-label_include_log=Include Logs
-label_template_booking_executed=Booking executed template
-label_street=Street
-label_zipCode=ZIP Code
-label_city=City
-label_groupName=Groupname
-label_phoneNumber=Phone Number
-label_template_waitlist_cancelled=Waitlist cancelled mail template
-msgs_menu_status=Status
-menu_status=Status
-button_add=Add
-passwords_different=Passwords do not match, please check input
diff --git a/account-ui/src/main/webapp/WEB-INF/beans.xml b/account-ui/src/main/webapp/WEB-INF/beans.xml
deleted file mode 100644
index b14f778..0000000
--- a/account-ui/src/main/webapp/WEB-INF/beans.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
diff --git a/account-ui/src/main/webapp/WEB-INF/faces-config.xml b/account-ui/src/main/webapp/WEB-INF/faces-config.xml
deleted file mode 100644
index 98774fb..0000000
--- a/account-ui/src/main/webapp/WEB-INF/faces-config.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- org.primefaces.application.exceptionhandler.PrimeExceptionHandlerELResolver
-
-
- en
- en
- de
-
-
-
- de.muehlencord.shared.account.web.presentation.messages
- msgs
-
-
-
-
diff --git a/account-ui/src/main/webapp/WEB-INF/jboss-web.xml b/account-ui/src/main/webapp/WEB-INF/jboss-web.xml
deleted file mode 100644
index f1fdbb4..0000000
--- a/account-ui/src/main/webapp/WEB-INF/jboss-web.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- ${context.root}
-
\ No newline at end of file
diff --git a/account-ui/src/main/webapp/WEB-INF/shiro.ini b/account-ui/src/main/webapp/WEB-INF/shiro.ini
deleted file mode 100644
index b3b5b10..0000000
--- a/account-ui/src/main/webapp/WEB-INF/shiro.ini
+++ /dev/null
@@ -1,59 +0,0 @@
-[main]
-
-# Context factory required for LDAP
-${shiro.contextFactory}
-
-cacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager
-securityManager.cacheManager = $cacheManager
-
-# DataSource Setup
-datasource = org.apache.shiro.jndi.JndiObjectFactory
-datasource.resourceName = java:/jboss/accountDs
-datasource.resourceRef = true
-
-# HashService
-hashService = org.apache.shiro.crypto.hash.DefaultHashService
-hashService.hashIterations = 500000
-hashService.hashAlgorithmName = SHA-512
-hashService.generatePublicSalt = true
-
-# Password service
-passwordService = org.apache.shiro.authc.credential.DefaultPasswordService
-passwordService.hashService = $hashService
-
-# Required password matcher
-${shiro.passwordMatcher}
-
-# LDAP Realm setup
-${shiro.ldapRealm}
-
-# JDBC Realm setup
-jdbcRealm = de.muehlencord.shared.account.shiro.realm.AccountRealm
-jdbcRealm.applicationId = ${applicationUuid}
-jdbcRealm.credentialsMatcher = $passwordMatcher
-jdbcRealm.dataSource = $datasource
-
-# Activate realms
-authcStrategy = ${shiro.authcStrategy}
-securityManager.realms = ${shiro.realms}
-securityManager.authenticator.authenticationStrategy = $authcStrategy
-
-# Setup authentication filter
-authc = de.muehlencord.shirofaces.filter.FacesAjaxAwarePassThruAuthenticationFilter
-authc.loginUrl = /login.xhtml
-authc.successUrl = /web/index.xhtml
-
-roles.unauthorizedUrl = /error/accessDenied.xhtml
-
-#
-# filter setup
-#
-[urls]
-/public/**=anon
-/resources/**=anon
-/fonts/**=anon
-/javax.faces.resource/**=anon
-/login.xhtml=authc
-/logout.xhtml=logout
-/**=authc
-# /web/**=authc
diff --git a/account-ui/src/main/webapp/WEB-INF/web.xml b/account-ui/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 4b93aac..0000000
--- a/account-ui/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,123 +0,0 @@
-
-
- reservation-system-backed
-
- javax.faces.PROJECT_STAGE
- ${jsf.projectStage}
-
-
- javax.faces.FACELETS_BUFFER_SIZE
- 1048576
-
-
- primefaces.THEME
- admin
-
-
- primefaces.FONT_AWESOME
- true
-
-
- primefaces.MOVE_SCRIPTS_TO_BOTTOM
- true
-
-
- FacesServlet
- javax.faces.webapp.FacesServlet
- 1
-
-
- FacesServlet
- *.xhtml
-
-
-
- 30
-
-
-
- index.xhtml
-
-
-
- org.apache.shiro.web.env.EnvironmentLoaderListener
-
-
- ShiroFilter
- shiroFilter
- org.apache.shiro.web.servlet.ShiroFilter
-
-
- shiroFilter
- /*
- REQUEST
- FORWARD
- INCLUDE
- ERROR
-
-
-
- FacesExceptionFilter
- facesExceptionFilter
- org.omnifaces.filter.FacesExceptionFilter
-
-
- facesExceptionFilter
- FacesServlet
-
-
-
- contentSecurityFilter
- de.muehlencord.sf.filter.ContentSecurityPolicyFilter
-
- report-only
- false
-
-
- default-src
- 'none'
-
-
- img-src
- 'self'
-
-
- script-src
- 'self' 'unsafe-inline' 'unsafe-eval'
-
-
- style-src
- 'self' 'unsafe-inline'
-
-
- connect-src
- 'self'
-
-
- font-src
- 'self'
-
-
- object-src
- 'none'
-
-
- media-src
- 'none'
-
-
- child-src
- 'none'
-
-
-
-
- OwaspStandardFilter
- owaspStandardFilter
- de.muehlencord.sf.filter.OwaspStandardFilter
-
-
- owaspStandardFilter
- /*
-
-
diff --git a/account-ui/src/main/webapp/index.xhtml b/account-ui/src/main/webapp/index.xhtml
deleted file mode 100644
index 67d8f87..0000000
--- a/account-ui/src/main/webapp/index.xhtml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/account-ui/src/main/webapp/login.xhtml b/account-ui/src/main/webapp/login.xhtml
deleted file mode 100644
index 5972e7b..0000000
--- a/account-ui/src/main/webapp/login.xhtml
+++ /dev/null
@@ -1,96 +0,0 @@
-
-
-
-
- Login Page
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Sign in to start your session
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/account-ui/src/main/webapp/logout.xhtml b/account-ui/src/main/webapp/logout.xhtml
deleted file mode 100644
index 809ae3d..0000000
--- a/account-ui/src/main/webapp/logout.xhtml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
- Logout
-
-
-
- You are logged out.
-
-
-
\ No newline at end of file
diff --git a/account-ui/src/main/webapp/resources/composite/confirmationDialog.xhtml b/account-ui/src/main/webapp/resources/composite/confirmationDialog.xhtml
deleted file mode 100644
index 0181029..0000000
--- a/account-ui/src/main/webapp/resources/composite/confirmationDialog.xhtml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/account-ui/src/main/webapp/resources/css/admin.css b/account-ui/src/main/webapp/resources/css/admin.css
deleted file mode 100644
index 771d6f3..0000000
--- a/account-ui/src/main/webapp/resources/css/admin.css
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-To change this license header, choose License Headers in Project Properties.
-To change this template file, choose Tools | Templates
-and open the template in the editor.
-*/
-/*
- Created on : 24.10.2018, 19:31:57
- Author : Joern Muehlencord
-*/
-
-.watermark {
- position: absolute;
- opacity: 0.25;
- font-size: 3em;
- width: 100%;
- text-align: center;
- z-index: 1000;
-}
\ No newline at end of file
diff --git a/account-ui/src/main/webapp/resources/template/footer.xhtml b/account-ui/src/main/webapp/resources/template/footer.xhtml
deleted file mode 100644
index 906ba4a..0000000
--- a/account-ui/src/main/webapp/resources/template/footer.xhtml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
- Account Management
-
-
-
- © Joern Muehlencord - Account Management - version ${applicationController.version} - build date ${applicationController.buildDate}
-
-
-
diff --git a/account-ui/src/main/webapp/resources/template/leftmenu.xhtml b/account-ui/src/main/webapp/resources/template/leftmenu.xhtml
deleted file mode 100644
index bf7f5e3..0000000
--- a/account-ui/src/main/webapp/resources/template/leftmenu.xhtml
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/account-ui/src/main/webapp/resources/template/template.xhtml b/account-ui/src/main/webapp/resources/template/template.xhtml
deleted file mode 100644
index e3d7889..0000000
--- a/account-ui/src/main/webapp/resources/template/template.xhtml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
-
- Account UI
-
-
-
-
-
- Account Management
-
-
-
- AM
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/account-ui/src/main/webapp/web/accounts.xhtml b/account-ui/src/main/webapp/web/accounts.xhtml
deleted file mode 100644
index 42da9e4..0000000
--- a/account-ui/src/main/webapp/web/accounts.xhtml
+++ /dev/null
@@ -1,341 +0,0 @@
-
-
-
-
- Account Overview
-
-
-
- for #{applicationView.currentApplication.applicationName}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/account-ui/src/main/webapp/web/applications.xhtml b/account-ui/src/main/webapp/web/applications.xhtml
deleted file mode 100644
index d702777..0000000
--- a/account-ui/src/main/webapp/web/applications.xhtml
+++ /dev/null
@@ -1,101 +0,0 @@
-
-
-
-
- Applications
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/account-ui/src/main/webapp/web/index.xhtml b/account-ui/src/main/webapp/web/index.xhtml
deleted file mode 100644
index 983dc13..0000000
--- a/account-ui/src/main/webapp/web/index.xhtml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- Home
-
-
-
- Home
-
-
\ No newline at end of file
diff --git a/account-ui/src/main/webapp/web/permissions.xhtml b/account-ui/src/main/webapp/web/permissions.xhtml
deleted file mode 100644
index 696ca3b..0000000
--- a/account-ui/src/main/webapp/web/permissions.xhtml
+++ /dev/null
@@ -1,108 +0,0 @@
-
-
-
-
- Permissions
-
-
-
- for #{applicationView.currentApplication.applicationName}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/account-ui/src/main/webapp/web/roles.xhtml b/account-ui/src/main/webapp/web/roles.xhtml
deleted file mode 100644
index 518667f..0000000
--- a/account-ui/src/main/webapp/web/roles.xhtml
+++ /dev/null
@@ -1,135 +0,0 @@
-
-
-
-
- Roles Overview
-
-
-
- for #{applicationView.currentApplication.applicationName}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/account/pom.xml b/account/pom.xml
deleted file mode 100644
index 63885ee..0000000
--- a/account/pom.xml
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
- 4.0.0
-
- de.muehlencord.shared
- shared-account
- ejb
-
-
- shared
- de.muehlencord
- 1.2-SNAPSHOT
-
-
- shared-account
-
-
-
- ${project.groupId}
- shared-db
- ejb
-
-
- ${project.groupId}
- shared-account-dao
-
-
- ${project.groupId}
- shared-util
- jar
-
-
-
- org.apache.commons
- commons-lang3
-
-
- org.freemarker
- freemarker
-
-
- org.apache.shiro
- shiro-core
- provided
-
-
- org.apache.shiro
- shiro-web
- provided
-
-
- ${project.groupId}
- shared-jeeutil
- jar
-
-
- org.junit.jupiter
- junit-jupiter-engine
- test
-
-
- org.mockito
- mockito-core
- test
-
-
- org.mockito
- mockito-junit-jupiter
- test
-
-
- org.slf4j
- slf4j-log4j12
- test
-
-
- org.slf4j
- jcl-over-slf4j
- test
-
-
- com.google.code.gson
- gson
-
-
- commons-io
- commons-io
-
-
- javax
- javaee-api
- jar
- provided
-
-
- org.hibernate
- hibernate-core
- provided
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-ejb-plugin
-
- 3.1
-
- **/persistence.xml
-
-
-
-
-
-
diff --git a/account/sql/account.dbm b/account/sql/account.dbm
deleted file mode 100644
index aa7455d..0000000
--- a/account/sql/account.dbm
+++ /dev/null
@@ -1,410 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/account/sql/account.sql b/account/sql/account.sql
deleted file mode 100644
index 869fc22..0000000
--- a/account/sql/account.sql
+++ /dev/null
@@ -1,251 +0,0 @@
--- Database generated with pgModeler (PostgreSQL Database Modeler).
--- pgModeler version: 0.9.2-beta
--- PostgreSQL version: 9.6
--- Project Site: pgmodeler.io
--- Model Author: ---
-
-
--- Database creation must be done outside a multicommand file.
--- These commands were put in this file only as a convenience.
--- -- object: account_test | type: DATABASE --
--- -- DROP DATABASE IF EXISTS account_test;
--- CREATE DATABASE account_test
--- ENCODING = 'UTF8'
--- LC_COLLATE = 'C'
--- LC_CTYPE = 'C';
--- -- ddl-end --
---
-
--- object: public.config | type: TABLE --
-DROP TABLE IF EXISTS public.config CASCADE;
-CREATE TABLE public.config (
- application uuid NOT NULL,
- config_key varchar(100) NOT NULL,
- config_key_account uuid NOT NULL,
- config_key_group varchar(200),
- config_value varchar(200),
- CONSTRAINT config_pk PRIMARY KEY (application,config_key,config_key_account)
-
-);
--- ddl-end --
-
--- object: public.application_role | type: TABLE --
-DROP TABLE IF EXISTS public.application_role CASCADE;
-CREATE TABLE public.application_role (
- id uuid NOT NULL,
- application uuid NOT NULL,
- role_name character varying(80) NOT NULL,
- role_description character varying(200) NOT NULL,
- CONSTRAINT application_role_pk PRIMARY KEY (id),
- CONSTRAINT application_role_name_uidx UNIQUE (application,role_name)
-
-);
--- ddl-end --
-
--- object: public.account | type: TABLE --
-DROP TABLE IF EXISTS public.account CASCADE;
-CREATE TABLE public.account (
- id uuid NOT NULL,
- username character varying(32) NOT NULL,
- emailaddress character varying(200) NOT NULL,
- firstname character varying(100) NOT NULL,
- lastname character varying(100) NOT NULL,
- status character varying(10) NOT NULL DEFAULT 'NEW',
- created_on timestamp with time zone NOT NULL DEFAULT timezone('utc'::text, now()),
- created_by character varying(32) NOT NULL,
- last_updated_on timestamp with time zone NOT NULL DEFAULT timezone('utc'::text, now()),
- last_updated_by character varying(32) NOT NULL,
- CONSTRAINT pk_account PRIMARY KEY (id),
- CONSTRAINT uidx_username UNIQUE (username)
-
-);
--- ddl-end --
-
--- object: public.account_history | type: TABLE --
-DROP TABLE IF EXISTS public.account_history CASCADE;
-CREATE TABLE public.account_history (
- id uuid NOT NULL,
- account_id uuid NOT NULL,
- message character varying(200),
- failure_count integer NOT NULL DEFAULT 0,
- status character varying(20) NOT NULL,
- last_updated_on timestamp with time zone NOT NULL DEFAULT timezone('utc'::text, now()),
- last_updated_by character varying(32) NOT NULL,
- CONSTRAINT pk_account_history PRIMARY KEY (id)
-
-);
--- ddl-end --
-
--- object: public.account_role | type: TABLE --
-DROP TABLE IF EXISTS public.account_role CASCADE;
-CREATE TABLE public.account_role (
- account uuid NOT NULL,
- account_role uuid NOT NULL,
- CONSTRAINT pk_account_role PRIMARY KEY (account,account_role)
-
-);
--- ddl-end --
-
--- object: public.application_permission | type: TABLE --
-DROP TABLE IF EXISTS public.application_permission CASCADE;
-CREATE TABLE public.application_permission (
- id uuid NOT NULL,
- application uuid NOT NULL,
- permission_name character varying(80) NOT NULL,
- permission_description character varying(200) NOT NULL,
- CONSTRAINT pk_application_permission PRIMARY KEY (id),
- CONSTRAINT application_permission_name_uidx UNIQUE (application,permission_name)
-
-);
--- ddl-end --
-
--- object: public.role_permission | type: TABLE --
-DROP TABLE IF EXISTS public.role_permission CASCADE;
-CREATE TABLE public.role_permission (
- application_role uuid NOT NULL,
- role_permission uuid NOT NULL,
- CONSTRAINT pk_role_permission_role_permission_name PRIMARY KEY (application_role,role_permission)
-
-);
--- ddl-end --
-
--- object: public.mail_template | type: TABLE --
-DROP TABLE IF EXISTS public.mail_template CASCADE;
-CREATE TABLE public.mail_template (
- template_name character varying(40) NOT NULL,
- template_value text NOT NULL,
- CONSTRAINT mail_template_pk PRIMARY KEY (template_name)
-
-);
--- ddl-end --
-
--- object: public.application | type: TABLE --
-DROP TABLE IF EXISTS public.application CASCADE;
-CREATE TABLE public.application (
- id uuid NOT NULL,
- application_name varchar(200) NOT NULL,
- CONSTRAINT application_pk PRIMARY KEY (id)
-
-);
--- ddl-end --
-
--- -- object: "uuid-ossp" | type: EXTENSION --
--- -- DROP EXTENSION IF EXISTS "uuid-ossp" CASCADE;
--- CREATE EXTENSION "uuid-ossp"
--- WITH SCHEMA public;
--- -- ddl-end --
---
--- object: public.account_login | type: TABLE --
-DROP TABLE IF EXISTS public.account_login CASCADE;
-CREATE TABLE public.account_login (
- id uuid NOT NULL DEFAULT uuid_generate_v4(),
- account uuid NOT NULL,
- account_password varchar(200) NOT NULL,
- last_login timestamptz,
- last_failed_login timestamptz,
- failure_count integer NOT NULL DEFAULT 0,
- password_reset_ongoing boolean NOT NULL DEFAULT false,
- password_reset_valid_to timestamptz,
- password_reset_hash varchar(200),
- created_on timestamptz NOT NULL DEFAULT timezone('utc'::text, now()),
- created_by varchar(32) NOT NULL,
- last_updated_on timestamptz NOT NULL DEFAULT timezone('utc'::text, now()),
- last_updated_by varchar(32) NOT NULL,
- CONSTRAINT account_login_pk PRIMARY KEY (id),
- CONSTRAINT account_login_uidx UNIQUE (account)
-
-);
--- ddl-end --
-
--- object: public.api_key | type: TABLE --
-DROP TABLE IF EXISTS public.api_key CASCADE;
-CREATE TABLE public.api_key (
- id uuid NOT NULL,
- account uuid NOT NULL,
- api_key varchar(200) NOT NULL,
- issued_on timestamptz NOT NULL DEFAULT timezone('utc'::text, now()),
- expiration smallint,
- expires_on timestamptz NOT NULL,
- CONSTRAINT api_key_pk PRIMARY KEY (id)
-
-);
--- ddl-end --
-
--- object: config_key_account_fk | type: CONSTRAINT --
--- ALTER TABLE public.config DROP CONSTRAINT IF EXISTS config_key_account_fk CASCADE;
-ALTER TABLE public.config ADD CONSTRAINT config_key_account_fk FOREIGN KEY (config_key_account)
-REFERENCES public.account (id) MATCH FULL
-ON DELETE NO ACTION ON UPDATE NO ACTION;
--- ddl-end --
-
--- object: config_application_fk | type: CONSTRAINT --
--- ALTER TABLE public.config DROP CONSTRAINT IF EXISTS config_application_fk CASCADE;
-ALTER TABLE public.config ADD CONSTRAINT config_application_fk FOREIGN KEY (application)
-REFERENCES public.application (id) MATCH FULL
-ON DELETE NO ACTION ON UPDATE NO ACTION;
--- ddl-end --
-
--- object: application_role_app_fk | type: CONSTRAINT --
--- ALTER TABLE public.application_role DROP CONSTRAINT IF EXISTS application_role_app_fk CASCADE;
-ALTER TABLE public.application_role ADD CONSTRAINT application_role_app_fk FOREIGN KEY (application)
-REFERENCES public.application (id) MATCH FULL
-ON DELETE NO ACTION ON UPDATE NO ACTION;
--- ddl-end --
-
--- object: fk_account_history_username_fk | type: CONSTRAINT --
--- ALTER TABLE public.account_history DROP CONSTRAINT IF EXISTS fk_account_history_username_fk CASCADE;
-ALTER TABLE public.account_history ADD CONSTRAINT fk_account_history_username_fk FOREIGN KEY (account_id)
-REFERENCES public.account (id) MATCH SIMPLE
-ON DELETE NO ACTION ON UPDATE NO ACTION;
--- ddl-end --
-
--- object: fk_account_role_account | type: CONSTRAINT --
--- ALTER TABLE public.account_role DROP CONSTRAINT IF EXISTS fk_account_role_account CASCADE;
-ALTER TABLE public.account_role ADD CONSTRAINT fk_account_role_account FOREIGN KEY (account)
-REFERENCES public.account (id) MATCH SIMPLE
-ON DELETE NO ACTION ON UPDATE NO ACTION;
--- ddl-end --
-
--- object: fk_account_role_role_name | type: CONSTRAINT --
--- ALTER TABLE public.account_role DROP CONSTRAINT IF EXISTS fk_account_role_role_name CASCADE;
-ALTER TABLE public.account_role ADD CONSTRAINT fk_account_role_role_name FOREIGN KEY (account_role)
-REFERENCES public.application_role (id) MATCH SIMPLE
-ON DELETE NO ACTION ON UPDATE NO ACTION;
--- ddl-end --
-
--- object: application_permission_app_fk | type: CONSTRAINT --
--- ALTER TABLE public.application_permission DROP CONSTRAINT IF EXISTS application_permission_app_fk CASCADE;
-ALTER TABLE public.application_permission ADD CONSTRAINT application_permission_app_fk FOREIGN KEY (application)
-REFERENCES public.application (id) MATCH FULL
-ON DELETE NO ACTION ON UPDATE NO ACTION;
--- ddl-end --
-
--- object: fk_role_permission_application_role | type: CONSTRAINT --
--- ALTER TABLE public.role_permission DROP CONSTRAINT IF EXISTS fk_role_permission_application_role CASCADE;
-ALTER TABLE public.role_permission ADD CONSTRAINT fk_role_permission_application_role FOREIGN KEY (application_role)
-REFERENCES public.application_role (id) MATCH SIMPLE
-ON DELETE NO ACTION ON UPDATE NO ACTION;
--- ddl-end --
-
--- object: fk_role_permission_role_permission | type: CONSTRAINT --
--- ALTER TABLE public.role_permission DROP CONSTRAINT IF EXISTS fk_role_permission_role_permission CASCADE;
-ALTER TABLE public.role_permission ADD CONSTRAINT fk_role_permission_role_permission FOREIGN KEY (role_permission)
-REFERENCES public.application_permission (id) MATCH SIMPLE
-ON DELETE NO ACTION ON UPDATE NO ACTION;
--- ddl-end --
-
--- object: account_login_fk | type: CONSTRAINT --
--- ALTER TABLE public.account_login DROP CONSTRAINT IF EXISTS account_login_fk CASCADE;
-ALTER TABLE public.account_login ADD CONSTRAINT account_login_fk FOREIGN KEY (account)
-REFERENCES public.account (id) MATCH FULL
-ON DELETE NO ACTION ON UPDATE NO ACTION;
--- ddl-end --
-
--- object: api_key_account_fk | type: CONSTRAINT --
--- ALTER TABLE public.api_key DROP CONSTRAINT IF EXISTS api_key_account_fk CASCADE;
-ALTER TABLE public.api_key ADD CONSTRAINT api_key_account_fk FOREIGN KEY (account)
-REFERENCES public.account (id) MATCH FULL
-ON DELETE NO ACTION ON UPDATE NO ACTION;
--- ddl-end --
-
-
diff --git a/account/sql/account_prefill.sql b/account/sql/account_prefill.sql
deleted file mode 100644
index 3345c9f..0000000
--- a/account/sql/account_prefill.sql
+++ /dev/null
@@ -1,29 +0,0 @@
-DELETE FROM config;
-DELETE FROM account_role;
-DELETE FROM account_login;
-DELETE FROM account;
-DELETE FROM role_permission;
-DELETE FROM application_role;
-DELETE FROM application_permission;
-DELETE FROM application;
-
-INSERT INTO application (id, application_name) values ('143a2bd3-7e0b-4162-a76e-3031331c7dfe', 'Account UI');
-
--- add roles to Account UI application
-INSERT INTO application_role (id, application, role_name, role_description) values ('5cd0aca0-5466-483d-8f3e-c369f8061131','143a2bd3-7e0b-4162-a76e-3031331c7dfe', 'Admin', 'Admin role');
-INSERT INTO application_role (id, application, role_name, role_description) values ('da30060e-fd23-4016-a506-4e12e9322148','143a2bd3-7e0b-4162-a76e-3031331c7dfe', 'User', 'Standard user role');
-
--- create accounts
-INSERT INTO account (id, username, firstname, lastname, emailaddress, created_by, last_updated_by) values ('2a712ed4-30f8-47b4-a002-7d87441b7013', 'system', 'system', 'system', 'n/a', 'system', 'system');
-INSERT INTO account (id, username, emailaddress, firstname, lastname, created_by, last_updated_by) values('ab5c8337-6872-4aea-a9b9-78ea63706b8f','admin', 'joern@muehlencord.de', 'Joern', 'Muehlencord','system','system');
--- assign AccountUI.Admin role to admin user
-INSERT INTO account_role (account, account_role) values ('ab5c8337-6872-4aea-a9b9-78ea63706b8f', '5cd0aca0-5466-483d-8f3e-c369f8061131');
-
--- create login for user admin (login admin, password secret)
-INSERT INTO account_login (account, account_password, created_by, last_updated_by) VALUES ('ab5c8337-6872-4aea-a9b9-78ea63706b8f', '$shiro1$SHA-256$500000$4bHPNH9k539UjdFLgm/HOA==$T/n8skgoGSOtNw/c9ScDlXCiGrx2cZF0Esrvf6WPq6g=', 'system', 'system'); --admin/secret
-
--- config
-INSERT INTO config (application, config_key, config_key_account, config_value) VALUES ('143a2bd3-7e0b-4162-a76e-3031331c7dfe', 'account.maxFailedLogins', '2a712ed4-30f8-47b4-a002-7d87441b7013', '5');
-
-
-
diff --git a/account/sql/backupAccount.bat b/account/sql/backupAccount.bat
deleted file mode 100644
index dc152ab..0000000
--- a/account/sql/backupAccount.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-echo off
-SET BACKUPFOLDER=%~dp0
-"C:\Program Files\PostgreSQL\10\bin\pg_dump.exe" -U jomu -n public --column-inserts --attribute-inserts --no-owner --no-privileges --no-acl --clean account > %BACKUPFOLDER%\account.dump
-pause;
diff --git a/account/sql/backupAccountTest.bat b/account/sql/backupAccountTest.bat
deleted file mode 100644
index f6d809c..0000000
--- a/account/sql/backupAccountTest.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-echo off
-SET BACKUPFOLDER=%~dp0
-"C:\Program Files\PostgreSQL\10\bin\pg_dump.exe" -U jomu -n public --column-inserts --attribute-inserts --no-owner --no-privileges --no-acl --clean account_test > %BACKUPFOLDER%\account_test.dump
-pause;
diff --git a/account/sql/createDatabaseFileFromDBM.bat b/account/sql/createDatabaseFileFromDBM.bat
deleted file mode 100644
index d3769c4..0000000
--- a/account/sql/createDatabaseFileFromDBM.bat
+++ /dev/null
@@ -1,9 +0,0 @@
-@ECHO OFF
-set BASEDIR=%~dp0%
-set PGMODELER_DIR=c:\app\pgmodeler
-
-setlocal
-cd %PGMODELER_DIR%
-pgmodeler-cli -if %BASEDIR%/account.dbm -ef -do -of %BASEDIR%/account.sql
-
-pause
\ No newline at end of file
diff --git a/account/sql/drop_all_tables.sql b/account/sql/drop_all_tables.sql
deleted file mode 100644
index 2a19a6f..0000000
--- a/account/sql/drop_all_tables.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-DROP TABLE IF EXISTS config CASCADE;
-DROP TABLE IF EXISTS account_role CASCADE;
-DROP TABLE IF EXISTS account_login CASCADE;
-DROP TABLE IF EXISTS account CASCADE;
-DROP TABLE IF EXISTS role_permission CASCADE;
-DROP TABLE IF EXISTS application_role CASCADE;
-DROP TABLE IF EXISTS application_permission CASCADE;
-DROP TABLE IF EXISTS application CASCADE;
-DROP TABLE IF EXISTS account_history CASCADE;
-DROP TABLE IF EXISTS mail_template CASCADE;
-DROP TABLE IF EXISTS api_key CASCADE;
\ No newline at end of file
diff --git a/account/sql/restoreAccount.bat b/account/sql/restoreAccount.bat
deleted file mode 100644
index 571dfca..0000000
--- a/account/sql/restoreAccount.bat
+++ /dev/null
@@ -1,5 +0,0 @@
-@ECHO OFF
-SET BACKUPFOLDER=%~dp0
-"C:\Program Files\PostgreSQL\10\bin\psql.exe" -U jomu --set ON_ERROR_STOP=on account < %BACKUPFOLDER%\drop_all_tables.sql
-"C:\Program Files\PostgreSQL\10\bin\psql.exe" -U jomu --set ON_ERROR_STOP=on account < %BACKUPFOLDER%\restore.dump
-pause;
diff --git a/account/sql/restoreAccountTest.bat b/account/sql/restoreAccountTest.bat
deleted file mode 100644
index 591d1de..0000000
--- a/account/sql/restoreAccountTest.bat
+++ /dev/null
@@ -1,5 +0,0 @@
-@ECHO OFF
-SET BACKUPFOLDER=%~dp0
-"C:\Program Files\PostgreSQL\10\bin\psql.exe" -U jomu --set ON_ERROR_STOP=on account_test < %BACKUPFOLDER%\drop_all_tables.sql
-"C:\Program Files\PostgreSQL\10\bin\psql.exe" -U jomu --set ON_ERROR_STOP=on account_test < %BACKUPFOLDER%\restore.dump
-pause;
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/account/boundary/AccountPermissions.java b/account/src/main/java/de/muehlencord/shared/account/business/account/boundary/AccountPermissions.java
deleted file mode 100644
index ddc0000..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/account/boundary/AccountPermissions.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.account.boundary;
-
-import de.muehlencord.shared.account.util.Permission;
-
-/**
- *
- * @author Joern Muehlencord
- */
-public enum AccountPermissions implements Permission {
-
- ACCOUNT_ADD("account:add", "Allow to create a new account"),
- ACCOUNT_EDIT ("account:edit", "Allow to edit an existing account"),
- ACCOUNT_DELETE("account:delete", "Allow to delete an existing account"),
- ACCOUNT_LOGIN_ADD ("account:login:add", "Allow to create a login for a user"),
- ACCOUNT_LOGIN_EDIT ("account:login:edit", "Allow to change a login for a user"),
- ACCOUNT_LOGIN_DELETE ("account:login:delete", "Allow to delete a login for a user");
-
- private final String name;
- private final String description;
-
- private AccountPermissions(String permissionName, String permissionDesc) {
- this.name = permissionName;
- this.description = permissionDesc;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/account/boundary/AccountProducer.java b/account/src/main/java/de/muehlencord/shared/account/business/account/boundary/AccountProducer.java
deleted file mode 100644
index 04b433c..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/account/boundary/AccountProducer.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.account.boundary;
-
-import de.muehlencord.shared.account.business.account.control.AccountControl;
-import de.muehlencord.shared.account.business.account.entity.Account;
-import java.io.Serializable;
-import java.util.Locale;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import javax.annotation.ManagedBean;
-import javax.annotation.PostConstruct;
-import javax.ejb.EJB;
-import javax.enterprise.context.SessionScoped;
-import javax.enterprise.inject.Produces;
-import javax.faces.context.FacesContext;
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.subject.Subject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@ManagedBean
-@SessionScoped
-public class AccountProducer implements Serializable {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(AccountProducer.class);
- private static final long serialVersionUID = -3806204732038165311L;
- private final Map objectMap = new ConcurrentHashMap<>();
-
- @EJB
- AccountControl accountController;
-
- private Account account = null;
- private Locale locale = null;
-
- @PostConstruct
- public void init() {
- FacesContext currentInstance = FacesContext.getCurrentInstance();
- if (currentInstance == null) {
- locale = Locale.ENGLISH;
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Using default locale {}", locale);
- }
-
- } else {
- locale = currentInstance.getExternalContext().getRequestLocale();
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Using browser locale {}", locale);
- }
- }
- }
-
- @Produces
- public Account getAccount() {
- String accountName;
- if (account == null) {
- Subject subject = null;
- try {
- subject = SecurityUtils.getSubject();
- } catch (Exception ex) {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.error(ex.getMessage());
- LOGGER.error("Detailed stacktrace", new Object[]{ex});
- }
- }
- if (subject == null) {
- return null;
- }
-
- if ((subject.isAuthenticated() == false) && (subject.isRemembered() == false)) {
- return null;
- } else {
- accountName = subject.getPrincipal().toString();
- }
- account = accountController.getAccountEntity(accountName, true);
- // TODO introduce locale support to account and switch to pre-defined locale if set
- }
- return account;
- }
-
- public T getValue(String key, Class clazz) {
- if (objectMap.containsKey(key)) {
- Object obj = objectMap.get(key);
- if (obj == null) {
- return null;
- }
- try {
- return clazz.cast(obj);
- } catch (ClassCastException ex) {
- return null;
- }
- } else {
- return null;
- }
- }
-
- public void setValue(String key, Object obj) {
- objectMap.put(key, obj);
- }
-
- @Produces
- public Locale getLocale() {
- return locale;
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/account/boundary/ApiKeyError.java b/account/src/main/java/de/muehlencord/shared/account/business/account/boundary/ApiKeyError.java
deleted file mode 100644
index 8590c87..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/account/boundary/ApiKeyError.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.account.boundary;
-
-import de.muehlencord.shared.jeeutil.restexfw.APIError;
-import javax.ws.rs.core.Response;
-
-/**
- *
- * @author joern.muehlencord
- */
-public enum ApiKeyError implements APIError {
-
- JWT_NO_TOKEN(Response.Status.BAD_REQUEST, "1000", "jwt_no_token"),
- JWT_TOKEN_INVALID (Response.Status.FORBIDDEN, "1001", "jwt_token_invalid");
-
- private final Response.Status status;
- private final String errorCode;
- private final String messageKey;
-
- private ApiKeyError(Response.Status status, String errorCode, String messageKey) {
- this.status = status;
- this.errorCode = errorCode;
- this.messageKey = messageKey;
- }
-
- @Override
- public Response.Status getStatus() {
- return status;
- }
-
- @Override
- public String getErrorCode() {
- return this.errorCode;
- }
-
- @Override
- public String getMessageKey() {
- return this.messageKey;
- }
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/account/boundary/ApiKeyException.java b/account/src/main/java/de/muehlencord/shared/account/business/account/boundary/ApiKeyException.java
deleted file mode 100644
index f1743d0..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/account/boundary/ApiKeyException.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.account.boundary;
-
-/**
- *
- * @author Joern Muehlencord
- */
-public class ApiKeyException extends Exception {
-
- private static final long serialVersionUID = -8017749942111814929L;
-
- /**
- * Creates a new instance of ApiKeyException without detail message.
- */
- public ApiKeyException() {
- }
-
-
- /**
- * Constructs an instance of ApiKeyException with the specified detail message.
- * @param msg the detail message.
- */
- public ApiKeyException(String msg) {
- super(msg);
- }
-
- /**
- * Constructs an instance of ApiKeyException with the specified detail message and root cause.
- * @param msg the detail message.
- * @param th the root cause
- */
- public ApiKeyException(String msg, Throwable th) {
- super(msg,th);
- }
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/account/boundary/ApiKeyService.java b/account/src/main/java/de/muehlencord/shared/account/business/account/boundary/ApiKeyService.java
deleted file mode 100644
index 8b8e841..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/account/boundary/ApiKeyService.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.account.boundary;
-
-import de.muehlencord.shared.account.business.account.control.AccountControl;
-import de.muehlencord.shared.account.business.account.entity.AccountEntity;
-import de.muehlencord.shared.account.business.account.entity.ApiKeyEntity;
-import de.muehlencord.shared.account.business.account.entity.JWTObject;
-import de.muehlencord.shared.account.business.config.boundary.ConfigService;
-import de.muehlencord.shared.account.business.config.entity.ConfigException;
-import de.muehlencord.shared.account.dao.ApiKeyObject;
-import de.muehlencord.shared.account.util.AccountPU;
-import de.muehlencord.shared.db.ControllerException;
-import de.muehlencord.shared.jeeutil.jwt.JWTDecoder;
-import de.muehlencord.shared.jeeutil.jwt.JWTEncoder;
-import de.muehlencord.shared.jeeutil.jwt.JWTException;
-import de.muehlencord.shared.util.DateUtil;
-import de.muehlencord.shared.util.StringUtil;
-import java.io.Serializable;
-import java.time.ZoneId;
-import java.time.ZoneOffset;
-import java.time.ZonedDateTime;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import javax.annotation.PostConstruct;
-import javax.ejb.Lock;
-import javax.ejb.LockType;
-import javax.ejb.Stateless;
-import javax.ejb.TransactionAttribute;
-import javax.ejb.TransactionAttributeType;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-import javax.transaction.Transactional;
-import org.apache.commons.lang3.RandomStringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@Stateless
-public class ApiKeyService implements Serializable {
-
- private static final long serialVersionUID = -6981864888118320228L;
- private static final Logger LOGGER = LoggerFactory.getLogger(ApiKeyService.class);
-
- @Inject
- @AccountPU
- EntityManager em;
-
- @Inject
- AccountControl accountControl;
-
- @Inject
- ConfigService configService;
-
- private String password;
- private String issuer;
- private Short expirationInMinutes;
-
- @PostConstruct
- public void init() {
- if (configService == null) {
- password = null;
- issuer = null;
- } else {
- try {
- password = configService.getConfigValue("rest.password");
- issuer = configService.getConfigValue("rest.issuer");
- expirationInMinutes = Short.parseShort(configService.getConfigValue("rest.expiration_in_minutes", "120", true));
- } catch (ConfigException | NumberFormatException | ControllerException ex) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug(ex.toString(), ex);
- } else {
- LOGGER.error(ex.toString());
- }
- password = null;
- issuer = null;
- expirationInMinutes = null;
- }
-
- }
- }
-
- public ApiKeyEntity getApiKeyFromString(String encodedJWT) throws ApiKeyException {
- if (StringUtil.isEmpty(encodedJWT)) {
- throw new ApiKeyException("Must provide authorization information");
- }
- JWTObject jwt = getJWTObject(encodedJWT);
- Query query = em.createNamedQuery("ApiKeyEntity.findByApiKey");
- query.setParameter("apiKey", jwt.getUnqiueId());
- List apiKeys = query.getResultList();
- if ((apiKeys == null) || (apiKeys.isEmpty())) {
- throw new ApiKeyException("ApiKey not found in database");
- }
- return apiKeys.get(0);
- }
-
- public List getUsersApiKeys(AccountEntity account, boolean onlyValid) {
-
- Date now = DateUtil.getCurrentTimeInUTC();
- CriteriaBuilder cb = em.getCriteriaBuilder();
- CriteriaQuery cq = cb.createQuery(ApiKeyEntity.class);
- Root root = cq.from(ApiKeyEntity.class);
- Predicate accountPredicate = cb.equal(root.get("account"), account);
- Predicate searchPredicate;
- if (onlyValid) {
- Predicate expiresOnPredicate = cb.greaterThanOrEqualTo(root.get("expiresOn"), now);
- searchPredicate = cb.and(accountPredicate, expiresOnPredicate);
- } else {
- searchPredicate = accountPredicate;
- }
- cq.where(searchPredicate);
- cq.orderBy(cb.desc(root.get("expiresOn")));
- TypedQuery query = em.createQuery(cq);
- List resultList = query.getResultList();
- if (resultList == null) {
- return new ArrayList<>();
- } else {
- return resultList;
- }
- }
-
- public List getUsersApiKeys(String userName) {
- return getUsersApiKeys(accountControl.getAccountEntity(userName, false), false);
- }
-
- public List getValidUsersApiKeys(String userName) {
- return getUsersApiKeys(accountControl.getAccountEntity(userName, false), true);
- }
-
- @Transactional
- @Lock(LockType.WRITE)
- public ApiKeyObject createNewApiKey(String userName) throws ApiKeyException {
- if (userName == null) {
- throw new ApiKeyException("Username must not be null");
- }
- return createNewApiKey(userName, expirationInMinutes);
- }
-
- @Transactional
- @Lock(LockType.WRITE)
- public ApiKeyObject createNewApiKey(String userName, short expirationInMinutes) throws ApiKeyException {
- if (password == null || issuer == null || userName == null) {
- String hint = "password, issuer or username not set in, please validate configuration";
- throw new ApiKeyException(hint);
- }
- Date now = DateUtil.getCurrentTimeInUTC();
- ZonedDateTime issuedOn = ZonedDateTime.ofInstant(now.toInstant(), ZoneId.of("UTC"));
- ZonedDateTime expiresOn = issuedOn.plusMinutes(expirationInMinutes);
- Date expiresOnDate = Date.from(expiresOn.toInstant());
- String apiKeyString = RandomStringUtils.randomAscii(50);
-
- ApiKeyEntity apiKey = new ApiKeyEntity();
- apiKey.setAccount(accountControl.getAccountEntity(userName, false));
- apiKey.setApiKey(apiKeyString);
- apiKey.setIssuedOn(now);
- apiKey.setExpiresOn(expiresOnDate);
- apiKey.setExpiration(expirationInMinutes);
-
- return getApiKeyObject(apiKey);
- }
-
- public ApiKeyObject getApiKeyObject(ApiKeyEntity apiKey) throws ApiKeyException {
- if (apiKey == null) {
- throw new ApiKeyException("ApiKey must not be null");
- }
- ZonedDateTime issuedOn = ZonedDateTime.ofInstant(apiKey.getIssuedOn().toInstant(), ZoneId.of("UTC"));
- ZonedDateTime expiresOn = issuedOn.plusMinutes(expirationInMinutes);
- AccountEntity account = apiKey.getAccount();
- if (account == null) {
- throw new ApiKeyException("Account of apiKey must not be null");
- }
- String userName = account.getUsername();
- try {
- String jwtString = JWTEncoder.encode(password, issuer, issuedOn, userName, apiKey.getApiKey(), apiKey.getExpiration());
- em.persist(apiKey);
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Created API key for {}, valid for {} minutes", userName, expirationInMinutes);
- }
-
- ApiKeyObject apiKeyObject = new ApiKeyObject();
- apiKeyObject.setUserName(userName);
- apiKeyObject.setIssuedOn(Date.from(apiKey.getIssuedOn().toInstant()));
- apiKeyObject.setExpiresOn(Date.from(expiresOn.toInstant()));
- apiKeyObject.setAuthToken(jwtString);
-
- return apiKeyObject;
- } catch (JWTException ex) {
- throw new ApiKeyException("Cannot create apiKey. Reason: " + ex.toString(), ex);
- }
- }
-
- public boolean validateJWT(String encodedJWT) {
- JWTDecoder decoder = new JWTDecoder(password, issuer, encodedJWT);
- ApiKeyEntity validKey;
- try {
- validKey = getValidKey(decoder.getSubject(), decoder.getUniqueId(), encodedJWT);
- } catch (JWTException ex) {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace(ex.toString(), ex);
- }
- return false;
- }
- return validKey != null;
- }
-
- private ApiKeyEntity getValidKey(String userName, String apiKey, String authorizationHeader) throws JWTException {
- AccountEntity userAccount = accountControl.getAccountEntity(userName, false);
- if (userAccount == null) {
- throw new JWTException("AccountControl exception");
- }
- List apiKeys = getUsersApiKeys(userAccount, true);
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("Found {} keys for user {}", apiKeys.size(), userName);
- }
-
- Iterator it = apiKeys.iterator();
- ApiKeyEntity keyToLogout = null;
- while (keyToLogout == null && it.hasNext()) {
- ApiKeyEntity key = it.next();
- if (key.getApiKey().equals(apiKey)) {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("Found API key in database");
- }
-
- ZonedDateTime issuedOn = ZonedDateTime.ofInstant(key.getIssuedOn().toInstant(), ZoneOffset.UTC);
- String testString = JWTEncoder.encode(password, issuer, issuedOn, key.getAccount().getUsername(), key.getApiKey(), key.getExpiration());
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("Successfully created validation JWT for user {}", userName);
- }
-
- if (authorizationHeader.equals(testString)) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Found valid key for user {}", userName);
- }
- return key;
- }
- }
- }
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("No valid key for user {} found", userName);
- }
- return null;
- }
-
- public String getJWTFromApiKey(ApiKeyEntity apiKey) throws ApiKeyException {
- ZonedDateTime issuedAt = ZonedDateTime.ofInstant(apiKey.getIssuedOn().toInstant(), ZoneOffset.UTC);
- try {
- return JWTEncoder.encode(password, issuer, issuedAt, apiKey.getAccount().getUsername(), apiKey.getApiKey(), apiKey.getExpiration());
- } catch (JWTException ex) {
- throw new ApiKeyException("Cannot retrieve JWT from key. Reason: " + ex.toString(), ex);
- }
- }
-
- public JWTObject getJWTObject(String encodedJWT) {
- JWTDecoder decoder = new JWTDecoder(password, issuer, encodedJWT);
- JWTObject jwtObject = new JWTObject();
- jwtObject.setUserName(decoder.getSubject());
- jwtObject.setUnqiueId(decoder.getUniqueId());
- jwtObject.setValid(true);
- return jwtObject;
- }
-
- /**
- *
- * @param apiKey
- * @deprecated use delete (jwtObject) instead
- */
- @TransactionAttribute(TransactionAttributeType.REQUIRED)
- @Transactional
- @Lock(LockType.WRITE)
- @Deprecated
- public void delete(ApiKeyEntity apiKey) {
- em.remove(em.merge(apiKey));
- }
-
- @TransactionAttribute(TransactionAttributeType.REQUIRED)
- @Transactional
- @Lock(LockType.WRITE)
- public void delete(String authorizationHeader) throws ApiKeyException {
-
- JWTObject jwtObject = getJWTObject(authorizationHeader);
- if (jwtObject.isValid()) {
- String userName = jwtObject.getUserName();
-
- ApiKeyEntity keyToLogout;
- try {
- keyToLogout = getValidKey(userName, jwtObject.getUnqiueId(), authorizationHeader);
- } catch (JWTException ex) {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace(ex.getMessage(), ex);
- }
-
- keyToLogout = null;
- }
-
- if (keyToLogout == null) {
- // no valid key found - must not happen, JWTVeryfingFIlter should have catched this
- // FIXME - add logging / handle this problem
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("No valid key found, probably user {} has already logged out", userName);
- }
- throw new ApiKeyException("No valid key found, probably user " + userName + " has already logged out");
- } else {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Found matching apiKey to logout");
- }
- em.remove(em.merge(keyToLogout));
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Key deleted, user {} logged out from webservice", userName);
- }
- }
- } else {
- throw new ApiKeyException("Provided JWT is not valid");
- }
- }
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/account/control/AccountControl.java b/account/src/main/java/de/muehlencord/shared/account/business/account/control/AccountControl.java
deleted file mode 100644
index 335a330..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/account/control/AccountControl.java
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.account.control;
-
-import de.muehlencord.shared.account.business.account.entity.AccountEntity;
-import de.muehlencord.shared.account.business.account.entity.AccountException;
-import de.muehlencord.shared.account.business.account.entity.AccountLoginEntity;
-import de.muehlencord.shared.account.business.account.entity.AccountStatus;
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import de.muehlencord.shared.account.business.application.entity.ApplicationRoleEntity;
-import de.muehlencord.shared.account.business.config.boundary.ConfigService;
-import de.muehlencord.shared.account.business.config.entity.ConfigException;
-import de.muehlencord.shared.account.business.instance.boundary.ApplicationPermissions;
-import de.muehlencord.shared.account.business.mail.boundary.MailService;
-import de.muehlencord.shared.account.business.mail.entity.MailException;
-import de.muehlencord.shared.account.util.AccountPU;
-import de.muehlencord.shared.account.util.SecurityUtil;
-import de.muehlencord.shared.util.DateUtil;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.stream.Collectors;
-import javax.ejb.EJB;
-import javax.ejb.Lock;
-import javax.ejb.LockType;
-import javax.ejb.Stateless;
-import javax.ejb.TransactionAttribute;
-import javax.ejb.TransactionAttributeType;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
-import javax.persistence.NoResultException;
-import javax.persistence.Query;
-import javax.transaction.Transactional;
-import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.subject.Subject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author joern.muehlencord
- */
-@Stateless
-public class AccountControl implements Serializable {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(AccountControl.class.getName());
- private static final long serialVersionUID = 3424816272598108101L;
-
- @EJB
- private MailService mailService;
-
- @Inject
- private ApplicationEntity application;
-
- @Inject
- ConfigService configService;
-
- @Inject
- @AccountPU
- EntityManager em;
-
- public List getAllAccounts(boolean includeDisabled) {
- List resultList;
- if (includeDisabled) {
- resultList = getAllAccounts();
- } else {
- resultList = getActiveAccounts();
- }
-
- if (SecurityUtil.checkPermission(ApplicationPermissions.ACCOUNT_LIST)) {
- return resultList;
- } else {
- String currentUserName = SecurityUtils.getSubject().getPrincipal().toString();
- return resultList.stream()
- .filter(account -> account.getAccountLogin() != null)
- .filter(account -> account.getUsername().equals(currentUserName))
- .collect(Collectors.toList());
- }
- }
-
- /**
- * returns a list of active accounts
- *
- * @return a list of active accounts
- */
- private List getActiveAccounts() {
- Query query = em.createNamedQuery("AccountEntity.findActiveAccounts");
- query.setParameter("status", AccountStatus.DISABLED.name());
- return query.getResultList();
- }
-
- /**
- * returns a list of active accounts
- *
- * @return a list of active accounts
- */
- private List getAllAccounts() {
- Query query = em.createNamedQuery("AccountEntity.findAll");
- return query.getResultList();
- }
-
- @Lock(LockType.READ)
- @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
- public AccountEntity getAccountEntity(String userName, boolean loadRoles) {
- StringBuilder queryBuilder = new StringBuilder();
- queryBuilder.append("SELECT a FROM AccountEntity a ");
- if (loadRoles) {
- queryBuilder.append("LEFT JOIN FETCH a.applicationRoleList ");
- }
- queryBuilder.append("WHERE a.username = :username");
- Query query = em.createQuery(queryBuilder.toString());
- query.setParameter("username", userName);
- try {
- return (AccountEntity) query.getSingleResult();
- } catch (NoResultException ex) {
- return null;
- }
- }
-
- @Transactional
- public AccountEntity saveAccount(AccountEntity account, ApplicationEntity app, List applicationRoles) {
- Date now = DateUtil.getCurrentTimeInUTC();
- Subject currentUser = SecurityUtils.getSubject();
- String currentLoggedInUser = currentUser.getPrincipal().toString();
-
- account.setLastUpdatedBy(currentLoggedInUser); // FIXME - should be done via updateable
- account.setLastUpdatedOn(now);
-
- boolean newAccount = (account.getCreatedOn() == null);
-
- // new account
- if (newAccount) {
- account.setCreatedOn(now);
- account.setCreatedBy(currentLoggedInUser);
- em.persist(account);
- } else {
- em.merge(account);
-
- // reload account from db and join roles
- account = getAccountEntity(account.getUsername(), true);
- }
-
- // assign roles to account
- if (account.getApplicationRoleList() == null) {
- account.setApplicationRoleList(new ArrayList<>());
- }
-
- boolean roleSetupChanged = false;
- // remove roles which are no longer listed
- // ensure this is only done for the given application - keep the other applications untouched
- List assignedRoles = new ArrayList<>();
- assignedRoles.addAll(account.getApplicationRoleList());
- for (ApplicationRoleEntity currentlyAssignedRole : assignedRoles) {
- if ((currentlyAssignedRole.getApplication().equals(app) && (!applicationRoles.contains(currentlyAssignedRole)))) {
- account.getApplicationRoleList().remove(currentlyAssignedRole);
- roleSetupChanged = true;
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Removed role {} ({}) from user {}", currentlyAssignedRole.getRoleName(), application.getApplicationName(), account.getUsername());
- }
- }
- }
-
- // add newly added roles to role list
- for (ApplicationRoleEntity applicationRole : applicationRoles) {
- if (!account.getApplicationRoleList().contains(applicationRole)) {
- account.addApplicationRole(applicationRole);
- roleSetupChanged = true;
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Added role {} ({}) to account {}", applicationRole.getRoleName(), application.getApplicationName(), account.getUsername());
- }
- }
- }
-
- // update account in database if roles changed
- if (roleSetupChanged) {
- em.merge(account);
- }
- return account;
- }
-
- @Transactional
- public void deleteAccount(AccountEntity account) throws AccountException {
- Date now = DateUtil.getCurrentTimeInUTC();
- Subject currentUser = SecurityUtils.getSubject();
- String currentUserName = currentUser.getPrincipal().toString();
-
- if (account.getUsername().equals(currentUserName)) {
- throw new AccountException("Cannot delete own account");
- } else {
- account.setStatus(AccountStatus.DISABLED.name());
- account.setLastUpdatedBy(currentUserName);
- account.setLastUpdatedOn(now);
- em.merge(account);
- }
-
- }
-
- @Transactional
- public boolean initPasswordReset(String userName) {
- try {
- AccountEntity account = getAccountEntity(userName, false);
- if (account == null) {
- LOGGER.warn("Account with name " + userName + " not found");
- return false;
- }
-
- if (account.getAccountLogin() == null) {
- LOGGER.error("No login for account {} defined, cannot reset password", userName);
- return false;
- }
-
- if (account.getStatus().equals(AccountStatus.BLOCKED.name())) {
- LOGGER.warn("Account " + userName + " is locked, cannot initialize password reset");
- return false;
- }
-
- String randomString = RandomStringUtils.random(40, true, true);
-
- Date validTo = DateUtil.getCurrentTimeInUTC();
- validTo = new Date(validTo.getTime() + 1000 * 600); // 10 minutes to react
-
- account.getAccountLogin().setPasswordResetHash(randomString);
- account.getAccountLogin().setPasswordResetOngoing(true);
- account.getAccountLogin().setPasswordResetValidTo(validTo);
- mailService.sendPasswortResetStartEmail(account, randomString);
-
- em.merge(account.getAccountLogin());
- em.merge(account);
- return true;
- } catch (MailException | ConfigException ex) {
- LOGGER.error("Error while sending password reset mail. " + ex.toString());
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Error while sending password reset mail.", ex);
- }
- return false;
- }
- }
-
- @Transactional
- public boolean resetPassword(String userName, String newPassword, String resetPasswordToken) {
- AccountEntity account = getAccountEntity(userName, false);
-
- if (account == null) {
- LOGGER.warn("Error while resetting password, no account with username " + userName + " found");
- // TODO add extra logging for intrusion protection system like fail2ban
- return false;
- }
-
- if (account.getAccountLogin() == null) {
- // user has no defined login, cannot reset password
- return false;
- }
-
- if (account.getAccountLogin().getPasswordResetOngoing() && (account.getAccountLogin().getPasswordResetHash() != null) && (account.getAccountLogin().getPasswordResetValidTo() != null)) {
- Date now = DateUtil.getCurrentTimeInUTC();
- String storedHash = account.getAccountLogin().getPasswordResetHash().trim();
- if (account.getAccountLogin().getPasswordResetValidTo().after(now)) {
- if (storedHash.equals(resetPasswordToken)) {
- // everything ok, reset password
- executePasswordReset(account, newPassword);
- LOGGER.info("Updated password for user " + userName);
- return true;
- } else {
- // token is not valid, refuse to change password
- LOGGER.warn("Trying to reset password for user " + userName + " but wrong token " + resetPasswordToken + " provided");
- addLoginError(account);
- return false;
- }
- } else {
- // password reset token no longer valid
- LOGGER.warn("Trying to reset password for user " + userName + " but token is no longer valid");
- addLoginError(account);
- return false;
- }
- } else {
- // user is not is password reset mode
- LOGGER.warn("Trying to reset password for user " + userName + " but password reset was not requested");
- addLoginError(account);
- return false;
- }
- }
-
- private void executePasswordReset(AccountEntity account, String newPassword) {
- Date now = DateUtil.getCurrentTimeInUTC();
-
- String hashedPassword = SecurityUtil.createPassword(newPassword);
- if (account.getAccountLogin() == null) {
- return;
- }
- account.getAccountLogin().setAccountPassword(hashedPassword);
- account.getAccountLogin().setPasswordResetOngoing(false);
- account.getAccountLogin().setPasswordResetHash(null);
- account.getAccountLogin().setPasswordResetValidTo(null);
- account.setLastUpdatedBy(account.getUsername());
- account.setLastUpdatedOn(now);
- em.merge(account);
-
- }
-
- @Transactional
- public AccountLoginEntity updateSuccessFullLogin(AccountLoginEntity login, String byUser) {
- Date now = DateUtil.getCurrentTimeInUTC();
- // a scucessful login ends a password reset procedure
- if (login.getPasswordResetOngoing()) {
- login.setPasswordResetOngoing(false);
- login.setPasswordResetHash(null);
- login.setPasswordResetValidTo(null);
- login.setLastUpdatedOn(now);
- login.setLastUpdatedBy(byUser);
- }
-
- login.setLastLogin(now);
- login.setFailureCount(0);
- return updateLogin(login);
- }
-
- @Transactional
- public AccountLoginEntity updateLogin(AccountLoginEntity login) {
- return em.merge(login);
- }
-
- @Transactional
- public void updateLogin(AccountEntity account) {
- if (account.getAccountLogin() == null) {
- // TODO connect to IPRS - how can an account ask for an updated login if the user cannot login
- } else {
- updateSuccessFullLogin(account.getAccountLogin(), account.getUsername());
- }
- }
-
- @Transactional
- public void addLoginError(AccountEntity account) {
- if (account.getAccountLogin() == null) {
- LOGGER.error("No login defined for {}", account.getUsername());
- } else {
- try {
- Date now = DateUtil.getCurrentTimeInUTC();
- account.getAccountLogin().setLastFailedLogin(now);
- account.getAccountLogin().setFailureCount(account.getAccountLogin().getFailureCount() + 1);
-
- int maxFailedLogins = Integer.parseInt(configService.getConfigValue("account.maxFailedLogins"));
- if ((account.getAccountLogin().getFailureCount() >= maxFailedLogins) && (!account.getStatus().equals("LOCKED"))) { // TOD add status enum
- // max failed logins reached, disabling user
- LOGGER.info("Locking account " + account.getUsername() + " due to " + account.getAccountLogin().getFailureCount() + " failed logins");
- account.setStatus(AccountStatus.BLOCKED.name());
- }
-
- // on a failed login request, disable password reset
- account.getAccountLogin().setPasswordResetOngoing(false);
- account.getAccountLogin().setPasswordResetHash(null);
- account.getAccountLogin().setPasswordResetValidTo(null);
-
- account.setLastUpdatedBy("system");
- account.setLastUpdatedOn(now);
- em.merge(account);
- } catch (ConfigException ex) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug(ex.toString(), ex);
- } else {
- LOGGER.error(ex.toString());
- }
- }
- }
- }
-
- public AccountLoginEntity createLoginWithRandomPassword() {
- AccountLoginEntity login = new AccountLoginEntity();
- String randomPassword = RandomStringUtils.random(20, true, true);
- String hashedPassword = SecurityUtil.createPassword(randomPassword);
- login.setAccountPassword(hashedPassword);
- login.setLastLogin(null);
- login.setLastFailedLogin(null);
- login.setFailureCount(0);
-
- return login;
- }
-
- public String getHashedPassword(String password) {
- String hashedPassword = SecurityUtil.createPassword(password);
- return hashedPassword;
- }
-
- @Transactional
- public void addLogin(AccountEntity accountToAdd, AccountLoginEntity accountLogin) {
- Date now = DateUtil.getCurrentTimeInUTC();
- Subject currentUser = SecurityUtils.getSubject();
- String currentLoggedInUser = currentUser.getPrincipal().toString();
-
- AccountEntity account = em.merge(accountToAdd);
- accountLogin.setAccount(account);
- accountLogin.setCreatedBy(currentLoggedInUser);
- accountLogin.setCreatedOn(now);
- accountLogin.setLastUpdatedBy(currentLoggedInUser);
- accountLogin.setLastUpdatedOn(now);
- em.persist(accountLogin);
-
- account.setAccountLogin(accountLogin);
- em.merge(account);
-
- }
-
- @Transactional
- public void deleteLogin(AccountEntity accountToDelete) {
- AccountEntity account = em.merge(accountToDelete);
- AccountLoginEntity login = account.getAccountLogin();
- login.setAccount(null);
- account.setAccountLogin(null);
- em.remove(login);
- em.merge(account);
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/Account.java b/account/src/main/java/de/muehlencord/shared/account/business/account/entity/Account.java
deleted file mode 100644
index cda151e..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/Account.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.account.entity;
-
-/**
- *
- * @author Joern Muehlencord
- */
-public interface Account {
-
- String getUsername();
- String getFirstname();
- String getLastname();
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountConfigurationKey.java b/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountConfigurationKey.java
deleted file mode 100644
index d8afa4f..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountConfigurationKey.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.account.entity;
-
-/**
- *
- * @author Joern Muehlencord
- */
-public enum AccountConfigurationKey {
- // the base path of the application
- BaseUrl,
- // the full pass to the reset password page
- PasswordResetUrl,
- // injection handler
- Producer;
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountConfigurationValue.java b/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountConfigurationValue.java
deleted file mode 100644
index f47b639..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountConfigurationValue.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.account.entity;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import javax.enterprise.util.Nonbinding;
-import javax.inject.Qualifier;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@Target({ElementType.FIELD, ElementType.METHOD})
-@Retention(RetentionPolicy.RUNTIME)
-@Qualifier
-public @interface AccountConfigurationValue {
-
- @Nonbinding
- AccountConfigurationKey key();
-}
-
-
-
-
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountEntity.java b/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountEntity.java
deleted file mode 100644
index aebd7c3..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountEntity.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.account.entity;
-
-import de.muehlencord.shared.account.business.application.entity.ApplicationRoleEntity;
-import de.muehlencord.shared.account.business.config.entity.ConfigEntity;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-import javax.xml.bind.annotation.XmlRootElement;
-import org.hibernate.annotations.GenericGenerator;
-import org.hibernate.annotations.Type;
-
-/**
- * IMPORANT: DO NOT CACHE - e.g. password changes are not synchronized
- * @author joern.muehlencord
- */
-@Entity
-@Table(name = "account")
-@XmlRootElement
-@NamedQueries({
- @NamedQuery(name = "AccountEntity.findAll", query = "SELECT a FROM AccountEntity a ORDER by a.lastname, a.firstname"),
- @NamedQuery(name = "AccountEntity.findByUsername", query = "SELECT a FROM AccountEntity a WHERE a.username = :username"),
- @NamedQuery(name = "AccountEntity.findByStatus", query = "SELECT a FROM AccountEntity a WHERE a.status = :status"),
- @NamedQuery(name = "AccountEntity.findActiveAccounts", query = "SELECT a FROM AccountEntity a WHERE a.status <> :status"),
- @NamedQuery(name = "AccountEntity.findByCreatedOn", query = "SELECT a FROM AccountEntity a WHERE a.createdOn = :createdOn"),
- @NamedQuery(name = "AccountEntity.findByCreatedBy", query = "SELECT a FROM AccountEntity a WHERE a.createdBy = :createdBy"),
- @NamedQuery(name = "AccountEntity.findByLastUpdatedOn", query = "SELECT a FROM AccountEntity a WHERE a.lastUpdatedOn = :lastUpdatedOn"),
- @NamedQuery(name = "AccountEntity.findByLastUpdatedBy", query = "SELECT a FROM AccountEntity a WHERE a.lastUpdatedBy = :lastUpdatedBy")
-})
-public class AccountEntity implements Serializable, Account {
-
- private static final long serialVersionUID = 2174163529615355336L;
-
- @Id
- @Basic(optional = false)
- @NotNull
- @Column(name = "id")
- @GeneratedValue(generator = "uuid2")
- @GenericGenerator(name = "uuid2", strategy = "uuid2")
- @Type(type = "pg-uuid")
- private UUID id;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 32)
- @Column(name = "username")
- private String username;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 200)
- @Column(name = "emailaddress")
- private String emailaddress;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 100)
- @Column(name = "firstname")
- private String firstname;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 100)
- @Column(name = "lastname")
- private String lastname;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 10)
- @Column(name = "status")
- private String status;
- @Basic(optional = false)
- @NotNull
- @Column(name = "created_on")
- @Temporal(TemporalType.TIMESTAMP)
- private Date createdOn;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 32)
- @Column(name = "created_by")
- private String createdBy;
- @Basic(optional = false)
- @NotNull
- @Column(name = "last_updated_on")
- @Temporal(TemporalType.TIMESTAMP)
- private Date lastUpdatedOn;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 32)
- @Column(name = "last_updated_by")
- private String lastUpdatedBy;
- @JoinTable(name = "account_role", joinColumns = {
- @JoinColumn(name = "account", referencedColumnName = "id")}, inverseJoinColumns = {
- @JoinColumn(name = "account_role", referencedColumnName = "id")})
- @ManyToMany(fetch = FetchType.LAZY)
- private List applicationRoleList;
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "accountId", fetch = FetchType.LAZY)
- private List accountHistoryList;
- @OneToOne(cascade = CascadeType.ALL, mappedBy = "account")
- private AccountLoginEntity accountLogin;
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "account")
- private List configItems;
-
- public AccountEntity() {
- // empty constructor required for JPA
- }
-
- public void addApplicationRole(ApplicationRoleEntity applicationRole) {
- if (applicationRoleList == null) {
- applicationRoleList = new ArrayList<>();
- }
- applicationRoleList.add(applicationRole);
- }
-
- /* **** getter / setter **** */
- public UUID getId() {
- return id;
- }
-
- public void setId(UUID id) {
- this.id = id;
- }
-
- @Override
- public String getUsername() {
- return username;
- }
-
- public void setUsername(String username) {
- this.username = username;
- }
-
- public String getEmailaddress() {
- return emailaddress;
- }
-
- public void setEmailaddress(String emailaddress) {
- this.emailaddress = emailaddress;
- }
-
- @Override
- public String getFirstname() {
- return firstname;
- }
-
- public void setFirstname(String firstname) {
- this.firstname = firstname;
- }
-
- @Override
- public String getLastname() {
- return lastname;
- }
-
- public void setLastname(String lastname) {
- this.lastname = lastname;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public Date getCreatedOn() {
- return createdOn;
- }
-
- public void setCreatedOn(Date createdOn) {
- this.createdOn = createdOn;
- }
-
- public String getCreatedBy() {
- return createdBy;
- }
-
- public void setCreatedBy(String createdBy) {
- this.createdBy = createdBy;
- }
-
- public Date getLastUpdatedOn() {
- return lastUpdatedOn;
- }
-
- public void setLastUpdatedOn(Date lastUpdatedOn) {
- this.lastUpdatedOn = lastUpdatedOn;
- }
-
- public String getLastUpdatedBy() {
- return lastUpdatedBy;
- }
-
- public void setLastUpdatedBy(String lastUpdatedBy) {
- this.lastUpdatedBy = lastUpdatedBy;
- }
-
- public List getApplicationRoleList() {
- return applicationRoleList;
- }
-
- public void setApplicationRoleList(List applicationRoleList) {
- this.applicationRoleList = applicationRoleList;
- }
-
- public List getAccountHistoryList() {
- return accountHistoryList;
- }
-
- public void setAccountHistoryList(List accountHistoryList) {
- this.accountHistoryList = accountHistoryList;
- }
-
- public AccountLoginEntity getAccountLogin() {
- return accountLogin;
- }
-
- public void setAccountLogin(AccountLoginEntity accountLogin) {
- this.accountLogin = accountLogin;
- }
-
- public List getConfigItems() {
- return configItems;
- }
-
- public void setConfigItems(List configItems) {
- this.configItems = configItems;
- }
-
- @Override
- public int hashCode() {
- int hash = 0;
- hash += (id != null ? id.hashCode() : 0);
- return hash;
- }
-
- @Override
- public boolean equals(Object object) {
- // TODO: Warning - this method won't work in the case the id fields are not set
- if (!(object instanceof AccountEntity)) {
- return false;
- }
- AccountEntity other = (AccountEntity) object;
- if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "de.muehlencord.shared.account.entity.Account[ id=" + id + " ]";
- }
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountException.java b/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountException.java
deleted file mode 100644
index e8a13bb..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.account.entity;
-
-/**
- *
- * @author Raimund
- */
-public class AccountException extends Exception {
-
- /**
- * Creates a new instance of AccountException without detail
- * message.
- */
- public AccountException() {
- }
-
- /**
- * Constructs an instance of AccountException with the
- * specified detail message.
- *
- * @param msg the detail message.
- */
- public AccountException(String msg) {
- super(msg);
- }
-
- public AccountException(String entity_updated__deleted_please_reload, boolean b) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountHistoryEntity.java b/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountHistoryEntity.java
deleted file mode 100644
index 1599dd1..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountHistoryEntity.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.account.entity;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.UUID;
-import javax.persistence.Basic;
-import javax.persistence.Cacheable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-import javax.xml.bind.annotation.XmlRootElement;
-import org.hibernate.annotations.GenericGenerator;
-import org.hibernate.annotations.Type;
-
-/**
- *
- * @author joern.muehlencord
- */
-@Entity
-@Table(name = "account_history")
-@Cacheable
-@XmlRootElement
-@NamedQueries({
- @NamedQuery(name = "AccountHistoryEntity.findAll", query = "SELECT a FROM AccountHistoryEntity a"),
- @NamedQuery(name = "AccountHistoryEntity.findById", query = "SELECT a FROM AccountHistoryEntity a WHERE a.id = :id"),
- @NamedQuery(name = "AccountHistoryEntity.findByMessage", query = "SELECT a FROM AccountHistoryEntity a WHERE a.message = :message"),
- @NamedQuery(name = "AccountHistoryEntity.findByFailureCount", query = "SELECT a FROM AccountHistoryEntity a WHERE a.failureCount = :failureCount"),
- @NamedQuery(name = "AccountHistoryEntity.findByStatus", query = "SELECT a FROM AccountHistoryEntity a WHERE a.status = :status"),
- @NamedQuery(name = "AccountHistoryEntity.findByLastUpdatedOn", query = "SELECT a FROM AccountHistoryEntity a WHERE a.lastUpdatedOn = :lastUpdatedOn"),
- @NamedQuery(name = "AccountHistoryEntity.findByLastUpdatedBy", query = "SELECT a FROM AccountHistoryEntity a WHERE a.lastUpdatedBy = :lastUpdatedBy")})
-public class AccountHistoryEntity implements Serializable {
-
- private static final long serialVersionUID = 1L;
- @Id
- @Basic(optional = false)
- @NotNull
- @Column(name = "id")
- @GeneratedValue(generator = "uuid2")
- @GenericGenerator(name = "uuid2", strategy = "uuid2")
- @Type(type = "pg-uuid")
- private UUID id;
- @Size(max = 200)
- @Column(name = "message")
- private String message;
- @Basic(optional = false)
- @NotNull
- @Column(name = "failure_count")
- private int failureCount;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 20)
- @Column(name = "status")
- private String status;
- @Basic(optional = false)
- @NotNull
- @Column(name = "last_updated_on")
- @Temporal(TemporalType.TIMESTAMP)
- private Date lastUpdatedOn;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 32)
- @Column(name = "last_updated_by")
- private String lastUpdatedBy;
- @JoinColumn(name = "account_id", referencedColumnName = "id")
- @ManyToOne(optional = false)
- private AccountEntity accountId;
-
- public AccountHistoryEntity() {
- }
-
- public AccountHistoryEntity(UUID id) {
- this.id = id;
- }
-
- public AccountHistoryEntity(UUID id, int failureCount, String status, Date lastUpdatedOn, String lastUpdatedBy) {
- this.id = id;
- this.failureCount = failureCount;
- this.status = status;
- this.lastUpdatedOn = lastUpdatedOn;
- this.lastUpdatedBy = lastUpdatedBy;
- }
-
- public UUID getId() {
- return id;
- }
-
- public void setId(UUID id) {
- this.id = id;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public int getFailureCount() {
- return failureCount;
- }
-
- public void setFailureCount(int failureCount) {
- this.failureCount = failureCount;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public Date getLastUpdatedOn() {
- return lastUpdatedOn;
- }
-
- public void setLastUpdatedOn(Date lastUpdatedOn) {
- this.lastUpdatedOn = lastUpdatedOn;
- }
-
- public String getLastUpdatedBy() {
- return lastUpdatedBy;
- }
-
- public void setLastUpdatedBy(String lastUpdatedBy) {
- this.lastUpdatedBy = lastUpdatedBy;
- }
-
- public AccountEntity getAccountId() {
- return accountId;
- }
-
- public void setAccountId(AccountEntity accountId) {
- this.accountId = accountId;
- }
-
- @Override
- public int hashCode() {
- int hash = 0;
- hash += (id != null ? id.hashCode() : 0);
- return hash;
- }
-
- @Override
- public boolean equals(Object object) {
- // TODO: Warning - this method won't work in the case the id fields are not set
- if (!(object instanceof AccountHistoryEntity)) {
- return false;
- }
- AccountHistoryEntity other = (AccountHistoryEntity) object;
- if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "de.muehlencord.shared.account.entity.AccountHistory[ id=" + id + " ]";
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountLoginEntity.java b/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountLoginEntity.java
deleted file mode 100644
index ad3b084..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountLoginEntity.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.account.entity;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.UUID;
-import javax.persistence.Basic;
-import javax.persistence.Cacheable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-import javax.xml.bind.annotation.XmlRootElement;
-import org.hibernate.annotations.GenericGenerator;
-import org.hibernate.annotations.Type;
-
-/**
- *
- * @author jomu
- */
-@Entity
-@Table(name = "account_login")
-@Cacheable
-@XmlRootElement
-@NamedQueries({
- @NamedQuery(name = "AccountLoginEntity.findAll", query = "SELECT a FROM AccountLoginEntity a"),
- @NamedQuery(name = "AccountLoginEntity.findByAccountPassword", query = "SELECT a FROM AccountLoginEntity a WHERE a.accountPassword = :accountPassword"),
- @NamedQuery(name = "AccountLoginEntity.findByLastLogin", query = "SELECT a FROM AccountLoginEntity a WHERE a.lastLogin = :lastLogin"),
- @NamedQuery(name = "AccountLoginEntity.findByLastFailedLogin", query = "SELECT a FROM AccountLoginEntity a WHERE a.lastFailedLogin = :lastFailedLogin"),
- @NamedQuery(name = "AccountLoginEntity.findByFailureCount", query = "SELECT a FROM AccountLoginEntity a WHERE a.failureCount = :failureCount"),
- @NamedQuery(name = "AccountLoginEntity.findByPasswordResetOngoing", query = "SELECT a FROM AccountLoginEntity a WHERE a.passwordResetOngoing = :passwordResetOngoing"),
- @NamedQuery(name = "AccountLoginEntity.findByPasswordResetValidTo", query = "SELECT a FROM AccountLoginEntity a WHERE a.passwordResetValidTo = :passwordResetValidTo"),
- @NamedQuery(name = "AccountLoginEntity.findByPasswordResetHash", query = "SELECT a FROM AccountLoginEntity a WHERE a.passwordResetHash = :passwordResetHash"),
- @NamedQuery(name = "AccountLoginEntity.findByCreatedOn", query = "SELECT a FROM AccountLoginEntity a WHERE a.createdOn = :createdOn"),
- @NamedQuery(name = "AccountLoginEntity.findByCreatedBy", query = "SELECT a FROM AccountLoginEntity a WHERE a.createdBy = :createdBy"),
- @NamedQuery(name = "AccountLoginEntity.findByLastUpdatedOn", query = "SELECT a FROM AccountLoginEntity a WHERE a.lastUpdatedOn = :lastUpdatedOn"),
- @NamedQuery(name = "AccountLoginEntity.findByLastUpdatedBy", query = "SELECT a FROM AccountLoginEntity a WHERE a.lastUpdatedBy = :lastUpdatedBy")})
-public class AccountLoginEntity implements Serializable {
-
- private static final long serialVersionUID = -799045989045040077L;
-
- @Id
- @Basic(optional = false)
- @NotNull
- @Column(name = "id")
- @GeneratedValue(generator = "uuid2")
- @GenericGenerator(name = "uuid2", strategy = "uuid2")
- @Type(type = "pg-uuid")
- private UUID id;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 200)
- @Column(name = "account_password")
- private String accountPassword;
- @Column(name = "last_login")
- @Temporal(TemporalType.TIMESTAMP)
- private Date lastLogin;
- @Column(name = "last_failed_login")
- @Temporal(TemporalType.TIMESTAMP)
- private Date lastFailedLogin;
- @Basic(optional = false)
- @NotNull
- @Column(name = "failure_count")
- private int failureCount;
- @Basic(optional = false)
- @NotNull
- @Column(name = "password_reset_ongoing")
- private boolean passwordResetOngoing;
- @Column(name = "password_reset_valid_to")
- @Temporal(TemporalType.TIMESTAMP)
- private Date passwordResetValidTo;
- @Size(max = 200)
- @Column(name = "password_reset_hash")
- private String passwordResetHash;
- @Basic(optional = false)
- @NotNull
- @Column(name = "created_on")
- @Temporal(TemporalType.TIMESTAMP)
- private Date createdOn;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 32)
- @Column(name = "created_by")
- private String createdBy;
- @Basic(optional = false)
- @NotNull
- @Column(name = "last_updated_on")
- @Temporal(TemporalType.TIMESTAMP)
- private Date lastUpdatedOn;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 32)
- @Column(name = "last_updated_by")
- private String lastUpdatedBy;
- @JoinColumn(name = "account", referencedColumnName = "id")
- @OneToOne(optional = false)
- private AccountEntity account;
-
- public AccountLoginEntity() {
- }
-
-
- public UUID getId() {
- return id;
- }
-
- public void setId(UUID id) {
- this.id = id;
- }
-
- public String getAccountPassword() {
- return accountPassword;
- }
-
- public void setAccountPassword(String accountPassword) {
- this.accountPassword = accountPassword;
- }
-
- public Date getLastLogin() {
- return lastLogin;
- }
-
- public void setLastLogin(Date lastLogin) {
- this.lastLogin = lastLogin;
- }
-
- public Date getLastFailedLogin() {
- return lastFailedLogin;
- }
-
- public void setLastFailedLogin(Date lastFailedLogin) {
- this.lastFailedLogin = lastFailedLogin;
- }
-
- public int getFailureCount() {
- return failureCount;
- }
-
- public void setFailureCount(int failureCount) {
- this.failureCount = failureCount;
- }
-
- public boolean getPasswordResetOngoing() {
- return passwordResetOngoing;
- }
-
- public void setPasswordResetOngoing(boolean passwordResetOngoing) {
- this.passwordResetOngoing = passwordResetOngoing;
- }
-
- public Date getPasswordResetValidTo() {
- return passwordResetValidTo;
- }
-
- public void setPasswordResetValidTo(Date passwordResetValidTo) {
- this.passwordResetValidTo = passwordResetValidTo;
- }
-
- public String getPasswordResetHash() {
- return passwordResetHash;
- }
-
- public void setPasswordResetHash(String passwordResetHash) {
- this.passwordResetHash = passwordResetHash;
- }
-
- public Date getCreatedOn() {
- return createdOn;
- }
-
- public void setCreatedOn(Date createdOn) {
- this.createdOn = createdOn;
- }
-
- public String getCreatedBy() {
- return createdBy;
- }
-
- public void setCreatedBy(String createdBy) {
- this.createdBy = createdBy;
- }
-
- public Date getLastUpdatedOn() {
- return lastUpdatedOn;
- }
-
- public void setLastUpdatedOn(Date lastUpdatedOn) {
- this.lastUpdatedOn = lastUpdatedOn;
- }
-
- public String getLastUpdatedBy() {
- return lastUpdatedBy;
- }
-
- public void setLastUpdatedBy(String lastUpdatedBy) {
- this.lastUpdatedBy = lastUpdatedBy;
- }
-
- public AccountEntity getAccount() {
- return account;
- }
-
- public void setAccount(AccountEntity account) {
- this.account = account;
- }
-
- @Override
- public int hashCode() {
- int hash = 0;
- hash += (id != null ? id.hashCode() : 0);
- return hash;
- }
-
- @Override
- public boolean equals(Object object) {
- // TODO: Warning - this method won't work in the case the id fields are not set
- if (!(object instanceof AccountLoginEntity)) {
- return false;
- }
- AccountLoginEntity other = (AccountLoginEntity) object;
- if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "de.muehlencord.shared.account.business.account.entity.AccountLoginEntity[ id=" + id + " ]";
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountStatus.java b/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountStatus.java
deleted file mode 100644
index a189ccf..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/AccountStatus.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.account.entity;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- * @author joern.muehlencord
- */
-public enum AccountStatus {
-
- NEW, // account is created but never used
- NORMAL, // normal account, at least on login, neither blocked or disabled
- BLOCKED, // account is blocked after too many login failures or other security related events
- DISABLED; // account is disabled and cannot be used anymore
-
- public static List getAllStatusNames() {
- List statusNames = new ArrayList<>();
- for (AccountStatus currentStatus : AccountStatus.values()) {
- statusNames.add (currentStatus.name());
- }
- return statusNames;
- }
-
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/ApiKeyEntity.java b/account/src/main/java/de/muehlencord/shared/account/business/account/entity/ApiKeyEntity.java
deleted file mode 100644
index 4c0cb55..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/ApiKeyEntity.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.account.entity;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.UUID;
-import javax.persistence.Basic;
-import javax.persistence.Cacheable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.QueryHint;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-import javax.xml.bind.annotation.XmlRootElement;
-import org.hibernate.annotations.GenericGenerator;
-import org.hibernate.annotations.Type;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@Entity
-@Cacheable
-@Table(name = "api_key")
-@XmlRootElement
-@NamedQueries({
- @NamedQuery(name = "ApiKeyEntity.findAll", query = "SELECT a FROM ApiKeyEntity a"),
- @NamedQuery(name = "ApiKeyEntity.findByApiKey", query = "SELECT a FROM ApiKeyEntity a WHERE a.apiKey = :apiKey",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")}),
- @NamedQuery(name = "ApiKeyEntity.findByIssuedOn", query = "SELECT a FROM ApiKeyEntity a WHERE a.issuedOn = :issuedOn"),
- @NamedQuery(name = "ApiKeyEntity.findByAccount", query = "SELECT a FROM ApiKeyEntity a WHERE a.account = :account ORDER BY a.issuedOn DESC",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")}),
- @NamedQuery(name = "ApiKeyEntity.findByExpiration", query = "SELECT a FROM ApiKeyEntity a WHERE a.expiration = :expiration")})
-public class ApiKeyEntity implements Serializable {
-
- private static final long serialVersionUID = -1044658457228215810L;
-
- @Id
- @Basic(optional = false)
- @NotNull
- @Column(name = "id")
- @GeneratedValue(generator = "uuid2")
- @GenericGenerator(name = "uuid2", strategy = "uuid2")
- @Type(type = "pg-uuid")
- private UUID id;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 200)
- @Column(name = "api_key")
- private String apiKey;
- @Basic(optional = false)
- @NotNull
- @Column(name = "issued_on")
- @Temporal(TemporalType.TIMESTAMP)
- private Date issuedOn;
- @Column(name = "expiration")
- private Short expiration;
- @Basic(optional = false)
- @NotNull
- @Column(name = "expires_on")
- @Temporal(TemporalType.TIMESTAMP)
- private Date expiresOn;
- @JoinColumn(name = "account", referencedColumnName = "id")
- @ManyToOne(optional = false)
- private AccountEntity account;
-
- public ApiKeyEntity() {
- // empty constructor required for JPA
- }
-
- public UUID getId() {
- return id;
- }
-
- public void setId(UUID id) {
- this.id = id;
- }
-
- public String getApiKey() {
- return apiKey;
- }
-
- public void setApiKey(String apiKey) {
- this.apiKey = apiKey;
- }
-
- public Date getIssuedOn() {
- return issuedOn;
- }
-
- public void setIssuedOn(Date issuedOn) {
- this.issuedOn = issuedOn;
- }
-
- public Short getExpiration() {
- return expiration;
- }
-
- public void setExpiration(Short expiration) {
- this.expiration = expiration;
- }
-
- public Date getExpiresOn() {
- return expiresOn;
- }
-
- public void setExpiresOn(Date expiresOn) {
- this.expiresOn = expiresOn;
- }
-
- public AccountEntity getAccount() {
- return account;
- }
-
- public void setAccount(AccountEntity account) {
- this.account = account;
- }
-
- @Override
- public int hashCode() {
- int hash = 0;
- hash += (id != null ? id.hashCode() : 0);
- return hash;
- }
-
- @Override
- public boolean equals(Object object) {
- // TODO: Warning - this method won't work in the case the id fields are not set
- if (!(object instanceof ApiKeyEntity)) {
- return false;
- }
- ApiKeyEntity other = (ApiKeyEntity) object;
- if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "com.wincornixdorf.pcd.business.account.ApiKeyEntity[ id=" + id + " ]";
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/JWTObject.java b/account/src/main/java/de/muehlencord/shared/account/business/account/entity/JWTObject.java
deleted file mode 100644
index 085f208..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/account/entity/JWTObject.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.account.entity;
-
-/**
- *
- * @author Joern Muehlencord
- */
-public class JWTObject {
-
- private String userName;
- private String unqiueId;
- private boolean valid;
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public String getUnqiueId() {
- return unqiueId;
- }
-
- public void setUnqiueId(String unqiueId) {
- this.unqiueId = unqiueId;
- }
-
- public boolean isValid() {
- return valid;
- }
-
- public void setValid(boolean valid) {
- this.valid = valid;
- }
-
-
-
-
-
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/application/boundary/ApplicationError.java b/account/src/main/java/de/muehlencord/shared/account/business/application/boundary/ApplicationError.java
deleted file mode 100644
index f40f56e..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/application/boundary/ApplicationError.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.application.boundary;
-
-import de.muehlencord.shared.account.util.SecurityError;
-
-/**
- *
- * @author Joern Muehlencord
- */
-public enum ApplicationError implements SecurityError {
-
- LIST_DENIED("1000", "list_denied");
-
- private final String errorCode;
- private final String messageKey;
-
- private ApplicationError(String errorCode, String messageKey) {
- this.errorCode = errorCode;
- this.messageKey = messageKey;
- }
-
- @Override
- public String getErrorCode() {
- return errorCode;
- }
-
- @Override
- public String getMessageKey() {
- return messageKey;
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/application/control/ApplicationControl.java b/account/src/main/java/de/muehlencord/shared/account/business/application/control/ApplicationControl.java
deleted file mode 100644
index 4212c56..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/application/control/ApplicationControl.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.application.control;
-
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import de.muehlencord.shared.account.business.instance.boundary.ApplicationPermissions;
-import de.muehlencord.shared.account.util.AccountPU;
-import de.muehlencord.shared.account.util.AccountSecurityException;
-import de.muehlencord.shared.account.util.SecurityUtil;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-import javax.ejb.Stateless;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import javax.transaction.Transactional;
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.subject.Subject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@Stateless
-public class ApplicationControl implements Serializable {
-
- private static final long serialVersionUID = 4262608935325326191L;
- private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationControl.class);
-
- @Inject
- @AccountPU
- EntityManager em;
-
- public ApplicationEntity findById(UUID id) {
- return em.find(ApplicationEntity.class, id);
- }
-
- public List getAllApplications() throws AccountSecurityException {
- List resultList = new ArrayList<>();
- Query query = em.createNamedQuery("ApplicationEntity.findAll");
- List queryList = query.getResultList();
- if ((queryList == null) || (queryList.isEmpty())) {
- return resultList;
- }
-
- Subject currentUser = SecurityUtils.getSubject();
- if (currentUser == null)
- return resultList;
- String userName = currentUser.getPrincipal().toString();
-
- queryList.stream().forEach(app -> {
- String applicationName = app.getApplicationName(); // TODO add unique short cut to db model
- applicationName = applicationName.toLowerCase();
- applicationName = applicationName.replace (" ", "");
- String permissionName = ApplicationPermissions.APP_LIST.getName()+":"+applicationName;
- boolean userHasPermissionToListApplication = SecurityUtil.checkPermission (permissionName);
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("validating if user {} has permission {} = {}", userName, permissionName, userHasPermissionToListApplication);
- }
-
- if (userHasPermissionToListApplication) {
- resultList.add (app);
- }
- });
-
- return resultList;
- }
-
- @Transactional
- public ApplicationEntity createOrUpdate(ApplicationEntity app) {
- if (app == null) {
- // TODO add error handling
- return null;
- } else {
- if (app.getId() == null) {
- em.persist(app);
- ApplicationEntity returnValue = findByApplicationName(app.getApplicationName());
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Application {} created", app.getApplicationName());
- }
-
- return returnValue;
- } else {
- ApplicationEntity returnValue = em.merge(app);
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Applicateion {} updated", app.getApplicationName());
- }
- return returnValue;
- }
- }
- }
-
- public ApplicationEntity findByApplicationName(String applicationName) {
- Query query = em.createNamedQuery("ApplicationEntity.findByApplicationName");
- query.setParameter("applicationName", applicationName);
- List resultList = query.getResultList();
- if ((resultList == null) || (resultList.isEmpty())) {
- return null;
- } else {
- return resultList.get(0);
- }
- }
-
- @Transactional
- public void delete(ApplicationEntity app) {
- ApplicationEntity attachedApp = em.find(ApplicationEntity.class, app.getId());
- em.remove(attachedApp);
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Application {} deleted", app.getApplicationName());
- }
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/application/control/ApplicationPermissionControl.java b/account/src/main/java/de/muehlencord/shared/account/business/application/control/ApplicationPermissionControl.java
deleted file mode 100644
index 2ffbd8c..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/application/control/ApplicationPermissionControl.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.application.control;
-
-import de.muehlencord.shared.account.business.account.entity.AccountException;
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import de.muehlencord.shared.account.business.application.entity.ApplicationPermissionEntity;
-import de.muehlencord.shared.account.util.AccountPU;
-import de.muehlencord.shared.account.util.Permission;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.ejb.Stateless;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
-import javax.persistence.OptimisticLockException;
-import javax.persistence.Query;
-import javax.transaction.Transactional;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@Stateless
-public class ApplicationPermissionControl implements Serializable {
-
- private static final long serialVersionUID = -3761100587901739481L;
- private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationPermissionControl.class);
-
- @Inject
- @AccountPU
- EntityManager em;
-
- @Inject
- ApplicationEntity application;
-
- public List getApplicationPermissions(ApplicationEntity app) {
- if (application == null) {
- return Collections.EMPTY_LIST;
- }
- Query query = em.createNamedQuery("ApplicationPermissionEntity.findAll");
- query.setParameter("application", app);
- List permissionList = query.getResultList();
- if (permissionList == null) {
- return new ArrayList<>();
- } else {
- return permissionList;
- }
- }
-
- public ApplicationPermissionEntity findPermissionByName(ApplicationEntity application, String permissionName) {
- Query query = em.createNamedQuery("ApplicationPermissionEntity.findByPermissionName");
- query.setParameter("application", application);
- query.setParameter("permissionName", permissionName);
- List resultList = query.getResultList();
- if ((resultList == null) || (resultList.isEmpty())) {
- return null;
- } else {
- return resultList.get(0);
- }
- }
-
- @Transactional
- public void create(ApplicationEntity application, String name, String description) {
- ApplicationPermissionEntity permission = new ApplicationPermissionEntity(application, name, description);
- em.persist(permission);
- }
-
- @Transactional
- public void update(ApplicationPermissionEntity permission) throws AccountException {
- ApplicationPermissionEntity existing = attach(permission);
- em.merge(existing);
- }
-
- @Transactional
- public void createOrUpdate(ApplicationEntity application, String name, String description) {
- ApplicationPermissionEntity permission = findByName(application, name);
- if (permission == null) {
- permission = new ApplicationPermissionEntity(name, description);
- em.persist(permission);
- } else {
- permission.setPermissionDescription(description);
- em.merge(permission);
- }
- }
-
- @Transactional
- public void delete(ApplicationPermissionEntity permission) throws AccountException {
- ApplicationPermissionEntity existingPermission = attach(permission);
- em.remove(existingPermission);
- }
-
- public ApplicationPermissionEntity attach(ApplicationPermissionEntity permission) throws AccountException {
- try {
- return em.merge(permission);
- } catch (OptimisticLockException ex) {
- throw new AccountException("Entity updated / deleted, please reload", true);
- }
- }
-
- private ApplicationPermissionEntity findByName(ApplicationEntity application, String name) {
- Query query = em.createNamedQuery("ApplicationPermissionEntity.findByPermissionName");
- query.setParameter("application", application);
- query.setParameter("permissionName", name);
- List permissions = query.getResultList();
- if ((permissions == null) || (permissions.isEmpty())) {
- return null;
- } else {
- return permissions.get(0);
- }
- }
-
- @Transactional
- public void setupPermissions(List permissions) {
- if (application == null) {
- LOGGER.error("Application not initialized, cannot setup permissions");
- } else {
- for (Permission permission : permissions) {
- ApplicationPermissionEntity existingPermission = findByName(application, permission.getName());
- if (existingPermission == null) {
- // permission not available, create it
- LOGGER.info("missing permission {} of {}", permission.getName(), application.getApplicationName());
- existingPermission = new ApplicationPermissionEntity(permission.getName(), permission.getDescription());
- existingPermission.setApplication(application);
- em.persist(existingPermission);
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("missing permission {} added to {}", permission.getName(), application.getApplicationName());
- }
- } else {
- if (existingPermission.getPermissionDescription().equals(permission.getDescription())) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Permission {} for {} already exists, skipping", permission.getName(), application.getApplicationName());
- }
- } else {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("description of permssion {} for {} differs, resetting to orignal value {}", permission.getName(), application.getApplicationName(), permission.getDescription());
- }
-
- existingPermission.setPermissionDescription(permission.getDescription());
- em.merge(existingPermission);
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("updated permission description {} for {}", permission.getName(), application.getApplicationName());
- }
- }
- }
- }
- }
- }
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/application/control/ApplicationRoleControl.java b/account/src/main/java/de/muehlencord/shared/account/business/application/control/ApplicationRoleControl.java
deleted file mode 100644
index 12510cc..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/application/control/ApplicationRoleControl.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.application.control;
-
-import de.muehlencord.shared.account.business.account.entity.AccountException;
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import de.muehlencord.shared.account.business.application.entity.ApplicationPermissionEntity;
-import de.muehlencord.shared.account.business.application.entity.ApplicationRoleEntity;
-import de.muehlencord.shared.account.util.AccountPU;
-import de.muehlencord.shared.account.util.Permission;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import javax.ejb.EJB;
-import javax.ejb.Stateless;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
-import javax.persistence.OptimisticLockException;
-import javax.persistence.Query;
-import javax.transaction.Transactional;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@Stateless
-public class ApplicationRoleControl implements Serializable {
-
- private static final long serialVersionUID = 5962478269550134748L;
- private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationRoleControl.class);
-
- @EJB
- ApplicationPermissionControl applicationPermissionControl;
-
- @Inject
- @AccountPU
- EntityManager em;
-
- @Inject
- ApplicationEntity application;
-
- // TODO requires special role to maintain role for other allication
- public List getAllRoles(ApplicationEntity app) {
- Query query = em.createNamedQuery("ApplicationRoleEntity.findAll");
- query.setParameter("application", app);
-
- List roles = query.getResultList();
- if (roles == null) {
- return new ArrayList<>();
- } else {
- return roles;
- }
- }
-
- @Transactional
- // TODO requires special role to maintain role for other allication
- public void createOrUpdate(ApplicationEntity app, String name, String description) {
- ApplicationRoleEntity role = findByName(app, name);
- if (role == null) {
- role = new ApplicationRoleEntity(app, name, description);
- em.persist(role);
- } else {
- role.setRoleDescription(description);
- em.merge(role);
- }
- }
-
- @Transactional
- // TODO requires special role to maintain role for other allication
- public void create(ApplicationRoleEntity role) {
- em.persist(role);
- }
-
- @Transactional
- // TODO requires special role to maintain role for other allication
- public void update(ApplicationRoleEntity role) {
- em.merge(role);
- }
-
- @Transactional
- // TODO requires special role to maintain role for other allication
- public void delete(ApplicationRoleEntity role) throws AccountException {
- ApplicationRoleEntity existingRole = attach(role);
- em.remove(existingRole);
- }
-
- public ApplicationRoleEntity attach(ApplicationRoleEntity role) throws AccountException {
- try {
- return em.merge(role);
- } catch (OptimisticLockException ex) {
- throw new AccountException("Entity updated / deleted, please reload", true);
- }
- }
-
- public ApplicationRoleEntity findByName(String name) {
- return findByName(application, name);
- }
-
- // TODO requires special role to maintain role for other allication
- public ApplicationRoleEntity findByName(ApplicationEntity app, String name) {
- Query query = em.createNamedQuery("ApplicationRoleEntity.findByRoleName");
- query.setParameter("application", app);
- query.setParameter("roleName", name);
- List permissions = query.getResultList();
- if ((permissions == null) || (permissions.isEmpty())) {
- return null;
- } else {
- return permissions.get(0);
- }
- }
-
- public List getRolePermissions(ApplicationRoleEntity role) throws AccountException {
- ApplicationRoleEntity existingRole = em.find(ApplicationRoleEntity.class, role.getId());
- List permissions = existingRole.getApplicationPermissionList();
- if ((permissions != null) && (permissions.isEmpty())) {
- permissions.size(); // force list to load
- }
-
- return permissions;
- }
-
- public List getNotAssignedApplicationPermissions(ApplicationRoleEntity role) {
- try {
- List rolePermissions = getRolePermissions(role);
- List allPermssions = applicationPermissionControl.getApplicationPermissions(role.getApplication());
-
- List missingPermissions = new ArrayList<>();
- allPermssions.stream().filter((perm) -> (!rolePermissions.contains(perm))).forEachOrdered((perm) -> {
- missingPermissions.add(perm);
- });
- return missingPermissions;
- } catch (AccountException ex) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug(ex.toString(), ex);
- } else {
- LOGGER.debug(ex.toString());
- }
- return null;
- }
-
- }
-
- @Transactional
- // TODO requires special role to maintain role for other allication
- public void addPermission(ApplicationRoleEntity role, ApplicationPermissionEntity permission) throws AccountException {
- ApplicationRoleEntity existingRole = attach(role);
- if (existingRole.getApplicationPermissionList() == null) {
- existingRole.setApplicationPermissionList(new ArrayList<>());
- }
- existingRole.getApplicationPermissionList().add(permission);
- em.merge(role);
- }
-
- @Transactional
- // TODO requires special role to maintain role for other allication
- public void removePermission(ApplicationRoleEntity role, ApplicationPermissionEntity permission) throws AccountException {
- ApplicationRoleEntity existingRole = attach(role);
- if ((existingRole.getApplicationPermissionList() != null) && (existingRole.getApplicationPermissionList().contains(permission))) {
- existingRole.getApplicationPermissionList().remove(permission);
- }
- em.merge(role);
- }
-
- @Transactional
- public void setupRolePermission(List permissions, String roleName) throws AccountException {
- ApplicationRoleEntity role = findByName(application, roleName);
- if (role == null) {
- LOGGER.error("A role with name " + roleName + " is not defined for application " + application.getApplicationName());
- } else {
- for (Permission permission : permissions) {
- ApplicationPermissionEntity existingPermission = applicationPermissionControl.findPermissionByName(application, permission.getName());
- if (existingPermission == null) {
- LOGGER.error("Required permission " + permission.getName() + " of application " + application.getApplicationName() + " does not exist. Ensure to call setupPermissions first");
- } else {
- if (role.getApplicationPermissionList().contains(existingPermission)) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Permission {} already assigned to role {} of {}, skipping", permission.getName(), roleName, application.getApplicationName());
- }
- } else {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Permission {} not assigned to role {} of {}", permission.getName(), roleName, application.getApplicationName());
- }
- addPermission(role, existingPermission);
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Added permission {} to role {} of {}", permission.getName(), roleName, application.getApplicationName());
- }
- }
- }
- }
- }
-
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/application/entity/ApplicationEntity.java b/account/src/main/java/de/muehlencord/shared/account/business/application/entity/ApplicationEntity.java
deleted file mode 100644
index c647910..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/application/entity/ApplicationEntity.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.application.entity;
-
-import de.muehlencord.shared.account.business.config.entity.ConfigEntity;
-import java.io.Serializable;
-import java.util.List;
-import java.util.UUID;
-import javax.persistence.Basic;
-import javax.persistence.Cacheable;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.OneToMany;
-import javax.persistence.QueryHint;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-import org.hibernate.annotations.GenericGenerator;
-import org.hibernate.annotations.Type;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@Entity
-@Table(name = "application")
-@XmlRootElement
-@Cacheable
-@NamedQueries({
- @NamedQuery(name = "ApplicationEntity.findAll", query = "SELECT a FROM ApplicationEntity a",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")}),
- @NamedQuery(name = "ApplicationEntity.findByApplicationName", query = "SELECT a FROM ApplicationEntity a WHERE a.applicationName = :applicationName",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")})
-})
-
-public class ApplicationEntity implements Serializable {
-
- private static final long serialVersionUID = -6407525020014743727L;
-
- @Id
- @Basic(optional = false)
- @NotNull
- @Column(name = "id")
- @GeneratedValue(generator = "uuid2")
- @GenericGenerator(name = "uuid2", strategy = "uuid2")
- @Type(type = "pg-uuid")
- private UUID id;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 200)
- @Column(name = "application_name", unique = true)
- private String applicationName;
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "application")
- private List applicationRoleEntityList;
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "application")
- private List applicationPermissions;
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "application")
- private List configEntityList;
-
- public ApplicationEntity() {
- }
-
- public UUID getId() {
- return id;
- }
-
- public void setId(UUID id) {
- this.id = id;
- }
-
- public String getApplicationName() {
- return applicationName;
- }
-
- public void setApplicationName(String applicationName) {
- this.applicationName = applicationName;
- }
-
- @XmlTransient
- public List getApplicationRoleEntityList() {
- return applicationRoleEntityList;
- }
-
- public void setApplicationRoleEntityList(List applicationRoleEntityList) {
- this.applicationRoleEntityList = applicationRoleEntityList;
- }
-
- @XmlTransient
- public List getApplicationPermissions() {
- return applicationPermissions;
- }
-
- public void setApplicationPermissions(List applicationPermissions) {
- this.applicationPermissions = applicationPermissions;
- }
-
- @XmlTransient
- public List getConfigEntityList() {
- return configEntityList;
- }
-
- public void setConfigEntityList(List configEntityList) {
- this.configEntityList = configEntityList;
- }
-
- @Override
- public int hashCode() {
- int hash = 0;
- hash += (id != null ? id.hashCode() : 0);
- return hash;
- }
-
- @Override
- public boolean equals(Object object) {
- // TODO: Warning - this method won't work in the case the id fields are not set
- if (!(object instanceof ApplicationEntity)) {
- return false;
- }
- ApplicationEntity other = (ApplicationEntity) object;
- if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "de.muehlencord.shared.account.business.application.entity.ApplicationEntity[ id=" + id + " ]";
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/application/entity/ApplicationPermissionEntity.java b/account/src/main/java/de/muehlencord/shared/account/business/application/entity/ApplicationPermissionEntity.java
deleted file mode 100644
index 4012cb6..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/application/entity/ApplicationPermissionEntity.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.application.entity;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.UUID;
-import javax.persistence.Basic;
-import javax.persistence.Cacheable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToMany;
-import javax.persistence.ManyToOne;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.QueryHint;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-import org.hibernate.annotations.GenericGenerator;
-import org.hibernate.annotations.Type;
-
-/**
- *
- * @author joern.muehlencord
- */
-@Entity
-@Table(name = "application_permission")
-@XmlRootElement
-@Cacheable
-@NamedQueries({
- @NamedQuery(name = "ApplicationPermissionEntity.findAll", query = "SELECT a FROM ApplicationPermissionEntity a WHERE a.application=:application order by a.permissionName",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")}),
- @NamedQuery(name = "ApplicationPermissionEntity.findNotAssigned", query = "SELECT a FROM ApplicationPermissionEntity a LEFT OUTER JOIN a.applicationRoles r WHERE a.application=:application AND r NOT IN :permissions",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")}),
- @NamedQuery(name = "ApplicationPermissionEntity.findByPermissionName", query = "SELECT a FROM ApplicationPermissionEntity a WHERE a.application=:application AND a.permissionName = :permissionName",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")}),
- @NamedQuery(name = "ApplicationPermissionEntity.findByPermissionDescription", query = "SELECT a FROM ApplicationPermissionEntity a WHERE a.application=:application AND a.permissionDescription = :permissionDescription",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")})
-})
-public class ApplicationPermissionEntity implements Serializable {
-
- private static final long serialVersionUID = -8985982754544829534L;
-
- @Id
- @Basic(optional = false)
- @NotNull
- @Column(name = "id")
- @GeneratedValue(generator = "uuid2")
- @GenericGenerator(name = "uuid2", strategy = "uuid2")
- @Type(type = "pg-uuid")
- private UUID id;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 80)
- @Column(name = "permission_name")
- private String permissionName;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 200)
- @Column(name = "permission_description")
- private String permissionDescription;
- @JoinColumn(name = "application", referencedColumnName = "id")
- @ManyToOne(optional = false)
- private ApplicationEntity application;
- @ManyToMany(mappedBy = "applicationPermissionList")
- private List applicationRoles;
-
- public ApplicationPermissionEntity() {
- }
-
- public ApplicationPermissionEntity(UUID id) {
- this.id = id;
- }
-
- public ApplicationPermissionEntity(String permissionName, String permissionDescription) {
- this.id = null;
- this.permissionName = permissionName;
- this.permissionDescription = permissionDescription;
- }
-
- public ApplicationPermissionEntity(ApplicationEntity application, String permissionName, String permissionDescription) {
- this.id = null;
- this.application = application;
- this.permissionName = permissionName;
- this.permissionDescription = permissionDescription;
- }
-
- public ApplicationPermissionEntity(UUID id, ApplicationEntity application, String permissionName, String permissionDescription) {
- this.id = id;
- this.application = application;
- this.permissionName = permissionName;
- this.permissionDescription = permissionDescription;
- }
-
- public UUID getId() {
- return id;
- }
-
- public void setId(UUID id) {
- this.id = id;
- }
-
- public String getPermissionName() {
- return permissionName;
- }
-
- public void setPermissionName(String permissionName) {
- this.permissionName = permissionName;
- }
-
- public String getPermissionDescription() {
- return permissionDescription;
- }
-
- public void setPermissionDescription(String permissionDescription) {
- this.permissionDescription = permissionDescription;
- }
-
- @XmlTransient
- public List getApplicationRoles() {
- return applicationRoles;
- }
-
- public void setApplicationRoles(List applicationRoles) {
- this.applicationRoles = applicationRoles;
- }
-
- @Override
- public int hashCode() {
- int hash = 0;
- hash += (id != null ? id.hashCode() : 0);
- return hash;
- }
-
- @Override
- public boolean equals(Object object) {
- // TODO: Warning - this method won't work in the case the id fields are not set
- if (!(object instanceof ApplicationPermissionEntity)) {
- return false;
- }
- ApplicationPermissionEntity other = (ApplicationPermissionEntity) object;
- if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "de.muehlencord.shared.account.entity.ApplicationPermission[ id=" + id + " ]";
- }
-
- public ApplicationEntity getApplication() {
- return application;
- }
-
- public void setApplication(ApplicationEntity application) {
- this.application = application;
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/application/entity/ApplicationRoleEntity.java b/account/src/main/java/de/muehlencord/shared/account/business/application/entity/ApplicationRoleEntity.java
deleted file mode 100644
index c42d69a..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/application/entity/ApplicationRoleEntity.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.application.entity;
-
-import de.muehlencord.shared.account.business.account.entity.AccountEntity;
-import java.io.Serializable;
-import java.util.List;
-import java.util.UUID;
-import javax.persistence.Basic;
-import javax.persistence.Cacheable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.ManyToOne;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.QueryHint;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-import org.hibernate.annotations.GenericGenerator;
-import org.hibernate.annotations.Type;
-
-/**
- *
- * @author joern.muehlencord
- */
-@Entity
-@Table(name = "application_role")
-@Cacheable
-@XmlRootElement
-@NamedQueries({
- @NamedQuery(name = "ApplicationRoleEntity.findAll", query = "SELECT a FROM ApplicationRoleEntity a WHERE a.application = :application ORDER BY a.roleName",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")}),
- @NamedQuery(name = "ApplicationRoleEntity.findByRoleName", query = "SELECT a FROM ApplicationRoleEntity a WHERE a.application = :application AND a.roleName = :roleName",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")}),
- @NamedQuery(name = "ApplicationRoleEntity.findByRoleDescription", query = "SELECT a FROM ApplicationRoleEntity a WHERE a.application = :application AND a.roleDescription = :roleDescription",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")})
-})
-
-public class ApplicationRoleEntity implements Serializable {
-
- private static final long serialVersionUID = -8324054525780893823L;
-
- @Id
- @Basic(optional = false)
- @NotNull
- @Column(name = "id")
- @GeneratedValue(generator = "uuid2")
- @GenericGenerator(name = "uuid2", strategy = "uuid2")
- @Type(type = "pg-uuid")
- private UUID id;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 80)
- @Column(name = "role_name")
- private String roleName;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 200)
- @Column(name = "role_description")
- private String roleDescription;
- @ManyToMany(mappedBy = "applicationRoleList")
- private List accountList;
- @JoinTable(name = "role_permission", joinColumns = {
- @JoinColumn(name = "application_role", referencedColumnName = "id")}, inverseJoinColumns = {
- @JoinColumn(name = "role_permission", referencedColumnName = "id")})
- @ManyToMany
- private List applicationPermissionList;
- @JoinColumn(name = "application", referencedColumnName = "id")
- @ManyToOne(optional = false)
- private ApplicationEntity application;
-
- public ApplicationRoleEntity() {
- }
-
- public ApplicationRoleEntity(ApplicationEntity application) {
- this.id = null;
- this.application = application;
- this.roleName = "";
- this.roleDescription = "";
- }
-
- public ApplicationRoleEntity(ApplicationEntity application, String roleName, String roleDescription) {
- this.id = null;
- this.application = application;
- this.roleName = roleName;
- this.roleDescription = roleDescription;
- }
-
- public ApplicationRoleEntity(UUID id, ApplicationEntity application, String roleName, String roleDescription) {
- this.id = id;
- this.application = application;
- this.roleName = roleName;
- this.roleDescription = roleDescription;
- }
-
- public UUID getId() {
- return id;
- }
-
- public void setId(UUID id) {
- this.id = id;
- }
-
- public String getRoleName() {
- return roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public String getRoleDescription() {
- return roleDescription;
- }
-
- public void setRoleDescription(String roleDescription) {
- this.roleDescription = roleDescription;
- }
-
- @XmlTransient
- public List getAccountList() {
- return accountList;
- }
-
- public void setAccountList(List accountList) {
- this.accountList = accountList;
- }
-
- @XmlTransient
- public List getApplicationPermissionList() {
- return applicationPermissionList;
- }
-
- public void setApplicationPermissionList(List applicationPermissionList) {
- this.applicationPermissionList = applicationPermissionList;
- }
-
- public ApplicationEntity getApplication() {
- return application;
- }
-
- public void setApplication(ApplicationEntity application) {
- this.application = application;
- }
-
- @Override
- public int hashCode() {
- int hash = 0;
- hash += (id != null ? id.hashCode() : 0);
- return hash;
- }
-
- @Override
- public boolean equals(Object object) {
- // TODO: Warning - this method won't work in the case the id fields are not set
- if (!(object instanceof ApplicationRoleEntity)) {
- return false;
- }
- ApplicationRoleEntity other = (ApplicationRoleEntity) object;
- if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "de.muehlencord.shared.account.entity.ApplicationRole[ id=" + id + " ]";
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/config/boundary/ConfigService.java b/account/src/main/java/de/muehlencord/shared/account/business/config/boundary/ConfigService.java
deleted file mode 100644
index f0a8cd8..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/config/boundary/ConfigService.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.config.boundary;
-
-import de.muehlencord.shared.account.business.account.entity.Account;
-import de.muehlencord.shared.account.business.account.entity.AccountEntity;
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import de.muehlencord.shared.account.business.config.entity.ConfigEntity;
-import de.muehlencord.shared.account.business.config.entity.ConfigEntityPK;
-import de.muehlencord.shared.account.business.config.entity.ConfigException;
-import de.muehlencord.shared.account.util.AccountPU;
-import de.muehlencord.shared.db.ControllerException;
-import java.io.Serializable;
-import java.util.List;
-import java.util.Optional;
-import javax.ejb.Lock;
-import javax.ejb.LockType;
-import javax.ejb.Singleton;
-import javax.ejb.Startup;
-import javax.ejb.TransactionAttribute;
-import javax.ejb.TransactionAttributeType;
-import static javax.ejb.TransactionAttributeType.REQUIRES_NEW;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import javax.transaction.Transactional;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author joern.muehlencord
- */
-@Singleton
-@Startup
-public class ConfigService implements Serializable {
-
- private static final long serialVersionUID = -3195224653632853003L;
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ConfigService.class);
-
- @Inject
- @AccountPU
- EntityManager em;
-
- @Inject
- ApplicationEntity application;
-
- /**
- * returns global config key which is not assigned to any. If more than one value is defined for the given key, the
- * key assigned to system is returned. If more than one key is defined but system key is not defined, an exception
- * is thrown.
- *
- * @param configKey the key to return
- * @return the configValue belonging to the given configKey
- * @throws de.muehlencord.shared.account.business.config.entity.ConfigException if more than one value is defined
- * for the given key but none of the values is defined for the system user
- */
- @Lock(LockType.READ)
- @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
- public String getConfigValue(String configKey) throws ConfigException {
- Query query = em.createNamedQuery("ConfigEntity.findByConfigKey");
- query.setParameter("application", application);
- query.setParameter("configKey", configKey);
- List configList = query.getResultList();
- if ((configList == null) || (configList.isEmpty())) {
- // key is not found in the database at all
- return null;
- } else if (configList.size() == 1) {
- // exact one element found, return this one
- return configList.get(0).getConfigValue();
- } else {
- // if more than one result found, return the one which is assigned to system if present
- // if not present, throw exception
- Optional firstItem = configList.stream()
- .filter(config -> config.getConfigPK().getConfigKeyAccount().getUsername().equals("system"))
- .findFirst();
- if (firstItem.isPresent()) {
- return firstItem.get().getConfigValue();
- } else {
- throw new ConfigException("ConfigKey " + configKey + " not unique and system value not defined");
- }
- }
- }
-
- // TODO replace with DAO?
- @Lock(LockType.READ)
- @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
- public List getApplicationConfigItems() {
- Query query = em.createNamedQuery("ConfigEntity.findByApplication");
- query.setParameter("application", application);
- List configList = query.getResultList();
- return configList;
- }
-
- @Lock(LockType.READ)
- @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
- public String getConfigValue(String configKey, String defaultValue) throws ConfigException, ControllerException {
- return getConfigValue(configKey, defaultValue, false);
- }
-
- @Transactional
- @Lock(LockType.WRITE)
- @TransactionAttribute(REQUIRES_NEW)
- public String getConfigValue(String configKey, String defaultValue, boolean storeDefaultValue) throws ConfigException, ControllerException {
- // get configValue as usual
- String configValue = getConfigValue(configKey);
-
- // if config value is not found null has been returned
- // in this case the value to return is the defaultValue
- if (StringUtils.isEmpty(configValue)) {
- configValue = defaultValue;
- }
-
- // check if the default value should be stored in the database
- if (storeDefaultValue) {
- AccountEntity account = getAccount("system");
- updateConfigValue(configKey, account, configValue);
- }
-
- return configValue;
- }
-
- @Lock(LockType.READ)
- @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
- public String getConfigValue(String configKey, String defaultValue, String accountName, boolean fallbackToSystem) throws ConfigException {
- Account account = getAccount(accountName);
- if (account == null) {
- if (fallbackToSystem) {
- return getConfigValue (configKey);
- } else {
- return defaultValue;
- }
- } else {
- return getConfigValue (configKey, account, fallbackToSystem);
- }
- }
-
- @Lock(LockType.READ)
- @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
- public String getConfigValue(String configKey, Account account, boolean fallbackToSystem) throws ConfigException {
- Query query = em.createNamedQuery("ConfigEntity.findByConfigKeyAndAccount");
- query.setParameter("application", application);
- query.setParameter("configKey", configKey);
- query.setParameter("account", account);
- List configList = query.getResultList();
- if ((configList == null) || (configList.isEmpty())) {
- // fallback to default / system value
- if (fallbackToSystem) {
- return getConfigValue(configKey);
- } else {
- return null;
- }
- } else if (configList.size() == 1) {
- // exact one element found, return this one
- return configList.get(0).getConfigValue();
- } else {
- // more than one value must not happen - this is not possible per the defintion of the datamodel
- throw new ConfigException("Cannot have more than one value for the the given key " + configKey + " and the given account " + account.getUsername());
- }
- }
-
- @Transactional
- @Lock(LockType.WRITE)
- @TransactionAttribute(REQUIRES_NEW)
- public String getConfigValue(String configKey, String defaultValue, boolean storeDefaultValue, Account account, boolean fallbackToSystem) throws ConfigException, ControllerException {
- String configValue = getConfigValue(configKey, account, fallbackToSystem);
-
- if (configValue == null) {
- // value not found for given account and if allowed also not found for system user
- configValue = defaultValue;
- }
-
- // check if the default value should be stored in the database
- if (storeDefaultValue) {
- updateConfigValue(configKey, account, configValue);
- }
-
- return configValue;
- }
-
- @Transactional
- @Lock(LockType.WRITE)
- @TransactionAttribute(REQUIRES_NEW)
- public boolean updateConfigValue(String configKey, String configValue) throws ConfigException, ControllerException {
- Account account = getAccount("system");
- return updateConfigValue(configKey, account, configValue);
- }
-
- @Transactional
- @Lock(LockType.WRITE)
- @TransactionAttribute(REQUIRES_NEW)
- public boolean updateConfigValue(String configKey, String accountName, String configValue) throws ControllerException {
- Account account = getAccount(accountName);
- if (accountName == null) {
- return false;
- }
- if (account == null) {
- LOGGER.error("Account for userName {} not found", accountName);
- return false;
- }
- return updateConfigValue(configKey, account, configValue);
- }
-
- @Transactional
- @Lock(LockType.WRITE)
- @TransactionAttribute(REQUIRES_NEW)
- public boolean updateConfigValue(String configKey, Account account, String configValue) throws ControllerException {
- if ((configKey == null) || (configKey.equals(""))) {
- // null or empty key
- return false;
- }
-
- if (account == null) {
- throw new ControllerException(ControllerException.CAUSE_CANNOT_PERSIST, "Account must not be null, not updating");
- }
-
- AccountEntity accountEntity = getAccount(account.getUsername());
- ConfigEntityPK pk = new ConfigEntityPK(application, configKey, accountEntity);
- ConfigEntity currentEntity = em.find(ConfigEntity.class, pk);
- if (currentEntity == null) {
- currentEntity = new ConfigEntity(pk);
- currentEntity.setConfigValue(configValue);
- em.persist(currentEntity);
- return true; // config item created - udpate performed
- } else {
- if ((currentEntity.getConfigValue() != null) && (currentEntity.getConfigValue().equals(configValue))) {
- // value is the same - no update
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("configValue {} not changed, keeping {}", configKey, currentEntity.getConfigValue());
- }
-
- return false;
- } else {
- String oldValue = currentEntity.getConfigValue();
- currentEntity.setConfigValue(configValue);
- em.merge(currentEntity);
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("configValue for {} updated from {} to {}", configKey, oldValue, configValue);
- }
- return true;
- }
- }
- }
-
- private AccountEntity getAccount(String accountName) {
- Query query = em.createNamedQuery("AccountEntity.findByUsername");
- query.setParameter("username", accountName);
- List accountList = query.getResultList();
- if ((accountList == null) || (accountList.isEmpty())) {
- return null;
- } else {
- return accountList.get(0);
- }
- }
-
- @TransactionAttribute(TransactionAttributeType.REQUIRED)
- @Transactional
- @Lock(LockType.WRITE)
- public void delete(ConfigEntity config) throws ControllerException {
- em.remove(em.merge(config));
- }
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/config/boundary/ConfigurationProducer.java b/account/src/main/java/de/muehlencord/shared/account/business/config/boundary/ConfigurationProducer.java
deleted file mode 100644
index 4a477a4..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/config/boundary/ConfigurationProducer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.config.boundary;
-
-import de.muehlencord.shared.account.business.account.entity.AccountConfigurationKey;
-import de.muehlencord.shared.account.business.account.entity.AccountConfigurationValue;
-import de.muehlencord.shared.account.business.config.entity.ConfigException;
-import javax.ejb.EJB;
-import javax.enterprise.context.Dependent;
-import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.spi.Annotated;
-import javax.enterprise.inject.spi.InjectionPoint;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@Dependent
-public class ConfigurationProducer {
-
- @EJB
- ConfigService configService;
-
- @Produces
- @AccountConfigurationValue(key = AccountConfigurationKey.Producer)
- public String produceConfigurationValue(InjectionPoint injectionPoint) {
- Annotated annotated = injectionPoint.getAnnotated();
- AccountConfigurationValue annotation = annotated.getAnnotation(AccountConfigurationValue.class);
- if (annotation != null) {
- AccountConfigurationKey key = annotation.key();
- if (key != null) {
- try {
- switch (key) {
- case BaseUrl:
- return configService.getConfigValue("base.url");
- case PasswordResetUrl:
- return configService.getConfigValue("base.url") + "/login.xhtml";
- default:
- throw new IllegalStateException("Invalid key " + key + " for injection point: " + injectionPoint);
- }
- } catch (ConfigException ex) {
- throw new IllegalStateException("Invalid key " + key + " for injection point: " + injectionPoint + ". Exception: " + ex.getMessage());
- }
- }
- }
- throw new IllegalStateException("No key for injection point: " + injectionPoint);
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/config/entity/ConfigEntity.java b/account/src/main/java/de/muehlencord/shared/account/business/config/entity/ConfigEntity.java
deleted file mode 100644
index 4728689..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/config/entity/ConfigEntity.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.config.entity;
-
-import de.muehlencord.shared.account.business.account.entity.AccountEntity;
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import java.io.Serializable;
-import javax.persistence.Cacheable;
-import javax.persistence.Column;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.QueryHint;
-import javax.persistence.Table;
-import javax.validation.constraints.Size;
-import javax.xml.bind.annotation.XmlRootElement;
-import org.hibernate.annotations.Cache;
-import org.hibernate.annotations.CacheConcurrencyStrategy;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@Entity
-@Table(name = "config")
-@XmlRootElement
-@Cacheable(true)
-@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL, region = "Configuration")
-@NamedQueries({
- @NamedQuery(name = "ConfigEntity.findAll", query = "SELECT c FROM ConfigEntity c ORDER BY c.configPK.configKey",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")}),
- @NamedQuery(name = "ConfigEntity.findByApplication", query = "SELECT c FROM ConfigEntity c WHERE c.configPK.application = :application",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")}),
- @NamedQuery(name = "ConfigEntity.findByConfigKey", query = "SELECT c FROM ConfigEntity c WHERE c.configPK.application = :application AND c.configPK.configKey = :configKey",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")}),
- @NamedQuery(name = "ConfigEntity.findByConfigKeyAndAccount", query = "SELECT c FROM ConfigEntity c WHERE c.configPK.application = :application AND c.configPK.configKey = :configKey AND c.configPK.configKeyAccount = :account",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")}),
- @NamedQuery(name = "ConfigEntity.findByConfigValue", query = "SELECT c FROM ConfigEntity c WHERE c.configPK.application = :application AND c.configValue = :configValue",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")})
-})
-
-public class ConfigEntity implements Serializable {
-
- private static final long serialVersionUID = -2013982316933782223L;
-
- @EmbeddedId
- protected ConfigEntityPK configPK;
- @Size(max = 2000)
- @Column(name = "config_value")
- private String configValue;
- @Size(max = 200)
- @Column(name = "config_key_group")
- private String configKeyGroup;
- @JoinColumn(name = "config_key_account", referencedColumnName = "id", insertable = false, updatable = false)
- @ManyToOne(optional = false)
- private AccountEntity account;
- @JoinColumn(name = "application", referencedColumnName = "id", insertable = false, updatable = false)
- @ManyToOne(optional = false)
- private ApplicationEntity application;
-
- public ConfigEntity() {
- }
-
- public ConfigEntity(ApplicationEntity application, String configKey, AccountEntity account) {
- this.configPK = new ConfigEntityPK(application, configKey, account);
- }
-
- public ConfigEntity(ConfigEntityPK configPK) {
- this.configPK = configPK;
- }
-
- public ConfigEntityPK getConfigPK() {
- return configPK;
- }
-
- public void setConfigPK(ConfigEntityPK configPK) {
- this.configPK = configPK;
- }
-
- public String getConfigValue() {
- return configValue;
- }
-
- public void setConfigValue(String configValue) {
- this.configValue = configValue;
- }
-
- public String getConfigKeyGroup() {
- return configKeyGroup;
- }
-
- public void setConfigKeyGroup(String configKeyGroup) {
- this.configKeyGroup = configKeyGroup;
- }
-
- @Override
- public int hashCode() {
- int hash = 0;
- hash += (configPK != null ? configPK.hashCode() : 0);
- return hash;
- }
-
- @Override
- public boolean equals(Object object) {
- // TODO: Warning - this method won't work in the case the id fields are not set
- if (!(object instanceof ConfigEntity)) {
- return false;
- }
- ConfigEntity other = (ConfigEntity) object;
- if ((this.configPK == null && other.configPK != null) || (this.configPK != null && !this.configPK.equals(other.configPK))) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "de.muehlencord.shared.account.business.config.entity.Config[ configPK=" + configPK + " ]";
- }
-
- public AccountEntity getAccount() {
- return account;
- }
-
- public void setAccount(AccountEntity account) {
- this.account = account;
- }
-
- public ApplicationEntity getApplication() {
- return application;
- }
-
- public void setApplication(ApplicationEntity application) {
- this.application = application;
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/config/entity/ConfigEntityPK.java b/account/src/main/java/de/muehlencord/shared/account/business/config/entity/ConfigEntityPK.java
deleted file mode 100644
index 140623f..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/config/entity/ConfigEntityPK.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.config.entity;
-
-import de.muehlencord.shared.account.business.account.entity.AccountEntity;
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import java.io.Serializable;
-import javax.persistence.Basic;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@Embeddable
-public class ConfigEntityPK implements Serializable {
-
- private static final long serialVersionUID = 8133795368429249008L;
-
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 100)
- @Column(name = "config_key")
- private String configKey;
- @JoinColumn(name = "config_key_account", referencedColumnName = "id", insertable = false, updatable = false)
- @ManyToOne(optional = false)
- private AccountEntity configKeyAccount;
- @JoinColumn(name = "application", referencedColumnName = "id", insertable = false, updatable = false)
- @ManyToOne(optional = false)
- private ApplicationEntity application;
-
- public ConfigEntityPK() {
- // empty constructor required for JPA
- }
-
- public ConfigEntityPK(ApplicationEntity application, String configKey, AccountEntity configKeyAccount) {
- this.application = application;
- this.configKey = configKey;
- this.configKeyAccount = configKeyAccount;
- }
-
- public String getConfigKey() {
- return configKey;
- }
-
- public void setConfigKey(String configKey) {
- this.configKey = configKey;
- }
-
- public AccountEntity getConfigKeyAccount() {
- return configKeyAccount;
- }
-
- public void setConfigKeyAccount(AccountEntity configKeyAccount) {
- this.configKeyAccount = configKeyAccount;
- }
-
- public ApplicationEntity getApplication() {
- return application;
- }
-
- public void setApplication(ApplicationEntity application) {
- this.application = application;
- }
-
- @Override
- public int hashCode() {
- int hash = 0;
- hash += (configKey != null ? configKey.hashCode() : 0);
- hash += (configKeyAccount != null ? configKeyAccount.hashCode() : 0);
- return hash;
- }
-
- @Override
- public boolean equals(Object object) {
- // TODO: Warning - this method won't work in the case the id fields are not set
- if (!(object instanceof ConfigEntityPK)) {
- return false;
- }
- ConfigEntityPK other = (ConfigEntityPK) object;
- if ((this.configKey == null && other.configKey != null) || (this.configKey != null && !this.configKey.equals(other.configKey))) {
- return false;
- }
- if ((this.configKeyAccount == null && other.configKeyAccount != null) || (this.configKeyAccount != null && !this.configKeyAccount.equals(other.configKeyAccount))) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "de.muehlencord.shared.account.business.config.entity.ConfigPK[ configKey=" + configKey + ", configKeyAccount=" + configKeyAccount + " ]";
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/config/entity/ConfigException.java b/account/src/main/java/de/muehlencord/shared/account/business/config/entity/ConfigException.java
deleted file mode 100644
index 678dca4..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/config/entity/ConfigException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.config.entity;
-
-/**
- *
- * @author Joern Muehlencord
- */
-public class ConfigException extends Exception {
-
- private static final long serialVersionUID = 7246584814637280123L;
-
- /**
- * Creates a new instance of ConfigException without detail
- * message.
- */
- public ConfigException() {
- }
-
- /**
- * Constructs an instance of ConfigException with the specified
- * detail message.
- *
- * @param msg the detail message.
- */
- public ConfigException(String msg) {
- super(msg);
- }
-
- /**
- * Constructs an instance of ConfigException with the specified
- * detail message and root cause.
- *
- * @param msg the detail message.
- * @param th the root cause
- */
- public ConfigException(String msg, Throwable th) {
- super(msg, th);
- }
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/instance/boundary/ApplicationPermissions.java b/account/src/main/java/de/muehlencord/shared/account/business/instance/boundary/ApplicationPermissions.java
deleted file mode 100644
index 6e9f048..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/instance/boundary/ApplicationPermissions.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.instance.boundary;
-
-import de.muehlencord.shared.account.util.Permission;
-
-/**
- *
- * @author Joern Muehlencord
- */
-public enum ApplicationPermissions implements Permission {
-
- APP_LIST("application:list", "Allows to list all avaiable applications"),
- APP_ADD("application:add", "Allow to add a new application"),
- APP_EDIT("application:edit", "Allow to edit an application"),
- APP_DELETE("application:delete", "Allow to delete an application"),
- PERMISSION_ADD("permission:add", "Allow to add a permission to an application"),
- PERMISSION_EDIT("permission:edit", "Allow to edit a permission"),
- PERMISSION_DELETE("permmission:delete", "Allow to delete a permission"),
- ROLE_ADD("role:add", "Allow to add a role to an application"),
- ROLE_EDIT("role:edit", "Allow to edit a role"),
- ROLE_DELETE("role:delete", "Allow to delete a role"),
- ROLE_PERMISSION_ASSIGN("role:permission:assign", "Allow to assign a permission to role"),
- ROLE_PERMISSION_REVOKE("role:permission:revoke", "All ow to revoke a permission from a role"),
- ACCOUNT_LIST ("account:list", "Allow to list all accounts of an application"),
- ACCOUNT_ADD ("account:add", "Allow to create a new account"),
- ACCOUNT_EDIT ("account:edit", "Allow to edit an existing account"),
- ACCOUNT_DELETE ("account:delete", "Allow to delete an existing account"),
- ACCOUNT_LOGIN_ADD ("account:login:add", "Allow to add a login to an account"),
- ACCOUNT_LOGIN_EDIT ("account:login:edit", "Allow to overwrite the password of an account"),
- ACCOUNT_LOGIN_DELETE ("account:login:delete", "Allow to delete the login of an account");
-
- private final String name;
- private final String description;
-
- private ApplicationPermissions(String permissionName, String permissionDesc) {
- this.name = permissionName;
- this.description = permissionDesc;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/instance/boundary/StartupBean.java b/account/src/main/java/de/muehlencord/shared/account/business/instance/boundary/StartupBean.java
deleted file mode 100644
index 0419c8f..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/instance/boundary/StartupBean.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.instance.boundary;
-
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import de.muehlencord.shared.account.business.config.boundary.ConfigService;
-import de.muehlencord.shared.account.business.config.entity.ConfigException;
-import de.muehlencord.shared.db.ControllerException;
-import javax.annotation.PreDestroy;
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.Initialized;
-import javax.enterprise.event.Observes;
-import javax.inject.Inject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@ApplicationScoped
-public class StartupBean {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(StartupBean.class);
-
- @Inject
- ConfigService configService;
-
- @Inject
- ApplicationEntity application;
-
- public void init(@Observes @Initialized(ApplicationScoped.class) Object init) {
- if (application == null) {
- LOGGER.error("Application not initialized");
- throw new RuntimeException ("Application not initilized, validate applicationUID mapping");
- } else {
- try {
- LOGGER.info("Starting application {}", application.getApplicationName());
- String instanceName = configService.getConfigValue("base.instance", "Development System", true);
- LOGGER.info("instanceName={}", instanceName);
-
- // ensure maxFailedLogins is available
- configService.getConfigValue("account.maxFailedLogins", "5", true);
-
- LOGGER.info("Application startup complete");
- } catch (ConfigException | ControllerException ex) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug(ex.toString(), ex);
- } else {
- LOGGER.error(ex.toString());
- }
- }
- }
- }
-
- @PreDestroy
- public void shutdown() {
- LOGGER.info("Shutting down application {}", application.getApplicationName());
-
- LOGGER.info("Application shutdown complete");
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/instance/control/ApplicationController.java b/account/src/main/java/de/muehlencord/shared/account/business/instance/control/ApplicationController.java
deleted file mode 100644
index 52d4416..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/instance/control/ApplicationController.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.instance.control;
-
-import de.muehlencord.shared.account.business.application.control.ApplicationControl;
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-import java.util.UUID;
-import javax.annotation.PostConstruct;
-import javax.ejb.EJB;
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Produces;
-import javax.inject.Named;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@Named("applicationController")
-@ApplicationScoped
-public class ApplicationController {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationController.class);
-
- @EJB
- ApplicationControl applicationService;
-
- private String version;
- private String buildDate;
- private UUID uuid;
- private ApplicationEntity application = null;
-
- @PostConstruct
- public void readBuildInfoProperties() {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("Trying to read buildInfo.properties");
- }
- InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("buildInfo.properties");
- if (in == null) {
- return;
- }
- Properties props = new Properties();
- try {
- props.load(in);
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("properties read from buildInfo.properties");
- }
-
- version = props.getProperty("build.version");
- buildDate = props.getProperty("build.timestamp");
- String uuidString = props.getProperty("application.uuid");
- if (StringUtils.isEmpty(uuidString)) {
- throw new RuntimeException("ApplicationId not defined, please check database setup");
- } else {
- uuid = UUID.fromString(uuidString);
- }
-
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("buildInfo.properties parsed successfully");
- }
-
- } catch (IOException ex) {
- LOGGER.error("Cannot find buildInfo.properties. ", ex);
- version = "??";
- buildDate = "??";
- uuid = null;
- throw new RuntimeException("Application id not readable, application will not be able to run");
- }
-
- if (uuid != null) {
- this.application = applicationService.findById(uuid);
- if (application == null) {
- throw new RuntimeException("ApplicationId " + uuid.toString() + " not readable, application will not be able to run. You need to setup application in account database first.");
- } else {
- LOGGER.info("Found application {} with id {}", application.getApplicationName(), uuid.toString());
- }
- }
- }
-
- /**
- * needs to return link to "Account UI" and not to current selected application TODO: ensure only Account UI can
- * call functions where application can be handed in - all other applications need to call the function which use
- * the injected application
- */
- @Produces
- public ApplicationEntity getApplication() {
- return application;
-
- }
-
- public String getVersion() {
- return version;
- }
-
- public String getBuildDate() {
- return buildDate;
- }
-
- public UUID getApplicationId() {
- return uuid;
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/mail/boundary/MailService.java b/account/src/main/java/de/muehlencord/shared/account/business/mail/boundary/MailService.java
deleted file mode 100644
index 7ceaddd..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/mail/boundary/MailService.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.mail.boundary;
-
-import de.muehlencord.shared.account.business.account.entity.AccountEntity;
-import de.muehlencord.shared.account.business.account.entity.AccountLoginEntity;
-import de.muehlencord.shared.account.business.config.boundary.ConfigService;
-import de.muehlencord.shared.account.business.config.entity.ConfigException;
-import de.muehlencord.shared.account.business.mail.entity.MailDatamodel;
-import de.muehlencord.shared.account.business.mail.entity.MailException;
-import de.muehlencord.shared.account.business.mail.entity.MailTemplateException;
-import java.io.File;
-import java.io.IOException;
-import java.io.Serializable;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-import javax.annotation.Resource;
-import javax.ejb.Stateless;
-import javax.inject.Inject;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Multipart;
-import javax.mail.Session;
-import javax.mail.Transport;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author joern.muehlencord
- */
-@Stateless
-public class MailService implements Serializable {
-
- private static final long serialVersionUID = -1937218474908356747L;
-
- private static final Logger LOGGER = LoggerFactory.getLogger(MailService.class);
-
- @Inject
- private MailTemplateService mailTemplateService;
-
- @Inject
- ConfigService configService;
-
-// @Inject
-// @AccountConfigurationValue(key = AccountConfigurationKey.BaseUrl)
-// private String baseUrl;
-
-// @Inject
-// @AccountConfigurationValue(key = AccountConfigurationKey.PasswordResetUrl)
-// private String passwordResetUrl;
-
- // TODO make this configurable by injection from the application it uses it, fall back to defaul mail setup if not available
- @Resource(lookup = "java:jboss/mail/ssgMail")
- private Session mailSession;
-
- public String sendTestEmail(String recipient) throws MailException {
- return sendMail(recipient, "Test email", "This is a test email");
- }
-
- public String sendTestHtmlEmail(String recipient) throws MailException {
- Date now = new Date();
- AccountEntity account = new AccountEntity();
- account.setId(UUID.randomUUID());
- account.setFirstname("Jörn");
- account.setLastname("Mühlencord");
- AccountLoginEntity accountLogin = new AccountLoginEntity();
- accountLogin.setAccountPassword("secret");
- accountLogin.setAccount(account);
- account.setAccountLogin(accountLogin);
- MailDatamodel dataModel = new MailDatamodel(account);
- dataModel.addParameter("url", "http://url.de");
- dataModel.addParameter("resetUrl", "http://reseturl.de");
- return sendHTMLMail(recipient, "Test HTML Email", dataModel, "password_reset_html");
- }
-
- public String sendMail(String recipient, String subject, String body) throws MailException {
- try {
- MimeMessage message = new MimeMessage(mailSession);
- message.setSubject(subject, "UTF-8");
- message.setFrom();
- message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipient, false));
- message.setText(body, "UTF-8");
- return transportMail(message);
- } catch (MessagingException ex) {
- throw new MailException("Error while sending email.", ex);
- }
- }
-
- public String sendHTMLMail(String recipient, String subject, MailDatamodel dataModel, String templateName) throws MailException {
- return sendHTMLMail(recipient, subject, dataModel, templateName, null);
- }
-
- public String sendHTMLMail(String recipient, String subject, MailDatamodel dataModel, String htmlTemplateName, String plainTemplateName) throws MailException {
- return sendHTMLMail(recipient, null, null, subject, dataModel, htmlTemplateName, plainTemplateName, "UTF-8", new ArrayList<>());
- }
-
- public String sendHTMLMail(String recipient, String ccRecipient, String bccRecipient, String subject, MailDatamodel dataModel, String htmlTemplateName, String plainTemplateName) throws MailException {
- return sendHTMLMail(recipient, ccRecipient, bccRecipient, subject, dataModel, htmlTemplateName, plainTemplateName, "UTF-8", new ArrayList<>());
- }
-
- public String sendHTMLMail(String recipient, String ccRecipient, String bccRecipient, String subject,
- MailDatamodel dataModel, String htmlTemplateName, String plainTemplateName, String encoding, List attachments) throws MailException {
-
- try {
- String htmlBody = mailTemplateService.getStringFromTemplate(htmlTemplateName, dataModel);
- String plainBody;
- if (plainTemplateName != null) {
- plainBody = mailTemplateService.getStringFromTemplate(plainTemplateName, dataModel);
- } else {
- plainBody = null;
- }
- return sendHTMLMail(recipient, ccRecipient, bccRecipient, subject, htmlBody, plainBody, encoding, attachments);
- } catch (MailTemplateException ex) {
- throw new MailException("Error while sending email.", ex);
- }
- }
-
- public String sendHTMLMail(String recipient, String ccRecipient, String bccRecipient, String subject, String htmlBody, String plainBody, String encoding, List attachments) throws MailException {
- try {
- MimeMessage message = new MimeMessage(mailSession);
- message.setFrom(); // use default from
- message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipient, false));
- if (ccRecipient != null) {
- message.setRecipients(Message.RecipientType.CC, InternetAddress.parse(ccRecipient, false));
- }
- if (bccRecipient != null) {
- message.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(bccRecipient, false));
- }
-
- message.setSubject(subject, encoding);
-
- Multipart contentMultiPart = new MimeMultipart("alternative");
-
- MimeBodyPart htmlBodyPart = new MimeBodyPart();
- htmlBodyPart.setContent(htmlBody, "text/html; charset=UTF-8");
- contentMultiPart.addBodyPart(htmlBodyPart);
-
- if (plainBody != null) {
- MimeBodyPart plainBodyPart = new MimeBodyPart();
- plainBodyPart.setText(plainBody, "UTF-8");
- contentMultiPart.addBodyPart(plainBodyPart);
- }
-
- if ((attachments == null) || (attachments.isEmpty())) {
- message.setContent(contentMultiPart);
- } else {
- MimeBodyPart contentBodyPart = new MimeBodyPart();
- contentBodyPart.setContent(contentMultiPart);
-
- MimeMultipart messageMultipart = new MimeMultipart("related");
- messageMultipart.addBodyPart(contentBodyPart);
- for (File attachment : attachments) {
- try {
- MimeBodyPart attachmentBodyPart = new MimeBodyPart();
- attachmentBodyPart.attachFile(attachment);
- String contentType = Files.probeContentType(attachment.toPath());
- if (contentType != null) {
- attachmentBodyPart.setHeader("Content-Type", contentType);
- }
- messageMultipart.addBodyPart(attachmentBodyPart);
- } catch (IOException ex) {
- throw new MailException("Cannot attach " + attachment.toString() + " to email. Reason: " + ex.toString(), ex);
- }
- }
- message.setContent(messageMultipart);
- }
- return transportMail(message);
- } catch (MessagingException ex) {
- throw new MailException("Error while sending email.", ex);
- }
- }
-
- public String sendPasswortResetStartEmail(AccountEntity account, String token) throws MailException, ConfigException {
- MailDatamodel model = new MailDatamodel(account);
-
- /* old aproach via FacesContext - add this back as fallback if injection point if not configured
- try {
- // String absoluteWebPath = FacesContext.getCurrentInstance().getExternalContext().getApplicationContextPath();
- ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
- String resetPage = "/login.xhtml?token=" + token;
- URL baseUrl;
-
- // TODO move out of this class, this is not mandatorily connected to a form
- baseUrl = new URL(externalContext.getRequestScheme(),
- externalContext.getRequestServerName(),
- externalContext.getRequestServerPort(),
- externalContext.getRequestContextPath());
- model.addParameter("url", baseUrl.toString());
- model.addParameter("resetUrl", baseUrl.toString() + resetPage);
- } catch (MalformedURLException ex) {
- throw new MailException("Error while sending email.", ex);
- }
-
- String resetUrlWithToken = baseUrl + "/login.xhtml?token=" + token;
- */
-
- String passwordResetUrl = configService.getConfigValue("backend.passwordreset.url");
- String baseUrl = configService.getConfigValue("backend.base.url");
- String resetUrlWithToken = passwordResetUrl + "?token=" + token;
-
- model.addParameter("url", baseUrl);
- model.addParameter("resetUrl", resetUrlWithToken);
- return sendHTMLMail(account.getEmailaddress(), "Reset your password", model, "password_reset_html");
- }
-
- private String transportMail(Message message) throws MessagingException {
- message.setSentDate(new Date());
- Transport.send(message);
- String messageId = message.getHeader("Message-ID")[0];
- LOGGER.info("Mail sent to {}, messageid = {}", message.getAllRecipients()[0].toString(), messageId);
- return messageId;
-
- }
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/mail/boundary/MailTemplateService.java b/account/src/main/java/de/muehlencord/shared/account/business/mail/boundary/MailTemplateService.java
deleted file mode 100644
index 8210000..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/mail/boundary/MailTemplateService.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.mail.boundary;
-
-import de.muehlencord.shared.account.business.mail.entity.MailDatamodel;
-import de.muehlencord.shared.account.business.mail.entity.MailTemplateEntity;
-import de.muehlencord.shared.account.business.mail.entity.MailTemplateException;
-import de.muehlencord.shared.account.util.AccountPU;
-import freemarker.cache.StringTemplateLoader;
-import freemarker.template.Configuration;
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
-import freemarker.template.TemplateExceptionHandler;
-import java.io.IOException;
-import java.io.Serializable;
-import java.io.StringWriter;
-import java.io.Writer;
-import javax.ejb.Lock;
-import javax.ejb.LockType;
-import javax.ejb.Stateless;
-import javax.ejb.TransactionAttribute;
-import javax.ejb.TransactionAttributeType;
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author jomu
- */
-@Stateless
-public class MailTemplateService implements Serializable {
-
- private static final long serialVersionUID = -136113381443058697L;
-
- private static final Logger LOGGER = LoggerFactory.getLogger(MailTemplateService.class.getName());
-
- @Inject
- @AccountPU
- EntityManager em;
-
- @Lock(LockType.READ)
- @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
- public String getStringFromTemplate(String templateName, MailDatamodel dataModel) throws MailTemplateException {
- try {
- Query query = em.createNamedQuery("MailTemplateEntity.findByTemplateName");
- query.setParameter("templateName", templateName);
- MailTemplateEntity templateEntity = (MailTemplateEntity) query.getSingleResult();
- if (templateEntity == null) {
- LOGGER.error("Tempate with name " + templateName + " not found");
- return null;
- }
- return fillTemplate(templateName, templateEntity.getTemplateValue(), dataModel);
- } catch (MailTemplateException ex) {
- String hint = "Error while processing template with name " + templateName + ".";
- LOGGER.error(hint + " " + ex.toString());
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug(hint, ex);
- }
- throw new MailTemplateException(hint, ex);
-
- }
- }
-
- @Lock(LockType.READ)
- @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
- public String fillTemplate(String templateName, String templateString, MailDatamodel dataModel) throws MailTemplateException {
- try {
- Configuration configuration = new Configuration(Configuration.VERSION_2_3_23);
- configuration.setDefaultEncoding("UTF-8"); // FIXME - make encoding configurable
- configuration.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
-
- StringTemplateLoader stringLoader = new StringTemplateLoader();
- stringLoader.putTemplate(templateName, templateString);
- configuration.setTemplateLoader(stringLoader);
- Template template = configuration.getTemplate(templateName);
-
- Writer out = new StringWriter();
- template.process(dataModel, out);
- String resultString = out.toString();
- return resultString;
- } catch (TemplateException | IOException ex) {
- String hint = "Error while processing template with name " + templateName + ".";
- LOGGER.error(hint + " " + ex.toString());
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug(hint, ex);
- }
- throw new MailTemplateException(hint, ex);
- }
- }
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/mail/entity/MailDatamodel.java b/account/src/main/java/de/muehlencord/shared/account/business/mail/entity/MailDatamodel.java
deleted file mode 100644
index 609ed1d..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/mail/entity/MailDatamodel.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.mail.entity;
-
-import de.muehlencord.shared.account.business.account.entity.AccountEntity;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- *
- * @author jomu
- */
-public class MailDatamodel {
-
- private final AccountEntity account;
- private final Map parameter;
-
- public MailDatamodel() {
- this.account = null;
- this.parameter = new HashMap<>();
- }
-
- public MailDatamodel(AccountEntity account) {
- this.parameter = new HashMap<>();
- this.account = account;
- }
-
- public void addParameter(String name, Object value) {
- this.parameter.put(name, value);
- }
-
-
- /* **** getter / setter **** */
-
- public AccountEntity getAccount() {
- return account;
- }
-
- public Map getParameter() {
- return parameter;
- }
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/mail/entity/MailException.java b/account/src/main/java/de/muehlencord/shared/account/business/mail/entity/MailException.java
deleted file mode 100644
index d0ea59a..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/mail/entity/MailException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.mail.entity;
-
-/**
- *
- * @author Raimund
- */
-public class MailException extends Exception {
-
- /**
- * Creates a new instance of MailException without detail
- * message.
- */
- public MailException() {
- }
-
- /**
- * Constructs an instance of MailException with the specified
- * detail message.
- *
- * @param msg the detail message.
- */
- public MailException(String msg) {
- super(msg);
- }
-
- /**
- * Constructs an instance of MailException with the specified
- * detail message.
- *
- * @param msg the detail message.
- * @param th the root cause
- */
- public MailException(String msg, Throwable th) {
- super(msg, th);
- }
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/mail/entity/MailTemplateEntity.java b/account/src/main/java/de/muehlencord/shared/account/business/mail/entity/MailTemplateEntity.java
deleted file mode 100644
index d199819..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/mail/entity/MailTemplateEntity.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.mail.entity;
-
-import java.io.Serializable;
-import javax.persistence.Basic;
-import javax.persistence.Cacheable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.QueryHint;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- *
- * @author joern.muehlencord
- */
-@Entity
-@Cacheable
-@Table(name = "mail_template")
-@XmlRootElement
-@NamedQueries({
- @NamedQuery(name = "MailTemplateEntity.findAll", query = "SELECT m FROM MailTemplateEntity m",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")}),
- @NamedQuery(name = "MailTemplateEntity.findByTemplateName", query = "SELECT m FROM MailTemplateEntity m WHERE m.templateName = :templateName",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")}),
- @NamedQuery(name = "MailTemplateEntity.findByTemplateValue", query = "SELECT m FROM MailTemplateEntity m WHERE m.templateValue = :templateValue",
- hints = {
- @QueryHint(name = "org.hibernate.cacheable", value = "true"),
- @QueryHint(name = "org.hibernate.cacheRegion", value = "Queries")})})
-public class MailTemplateEntity implements Serializable {
-
- private static final long serialVersionUID = 4527399247302581555L;
-
- @Id
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 40)
- @Column(name = "template_name")
- private String templateName;
- @Basic(optional = false)
- @NotNull
- @Size(min = 1, max = 2147483647)
- @Column(name = "template_value")
- private String templateValue;
-
- public MailTemplateEntity() {
- }
-
- public MailTemplateEntity(String templateName) {
- this.templateName = templateName;
- }
-
- public MailTemplateEntity(String templateName, String templateValue) {
- this.templateName = templateName;
- this.templateValue = templateValue;
- }
-
- public String getTemplateName() {
- return templateName;
- }
-
- public void setTemplateName(String templateName) {
- this.templateName = templateName;
- }
-
- public String getTemplateValue() {
- return templateValue;
- }
-
- public void setTemplateValue(String templateValue) {
- this.templateValue = templateValue;
- }
-
- @Override
- public int hashCode() {
- int hash = 0;
- hash += (templateName != null ? templateName.hashCode() : 0);
- return hash;
- }
-
- @Override
- public boolean equals(Object object) {
- // TODO: Warning - this method won't work in the case the id fields are not set
- if (!(object instanceof MailTemplateEntity)) {
- return false;
- }
- MailTemplateEntity other = (MailTemplateEntity) object;
- if ((this.templateName == null && other.templateName != null) || (this.templateName != null && !this.templateName.equals(other.templateName))) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "de.muehlencord.shared.account.entity.MailTemplate[ templateName=" + templateName + " ]";
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/business/mail/entity/MailTemplateException.java b/account/src/main/java/de/muehlencord/shared/account/business/mail/entity/MailTemplateException.java
deleted file mode 100644
index cde67d8..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/business/mail/entity/MailTemplateException.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.mail.entity;
-
-/**
- *
- * @author jomu
- */
-public class MailTemplateException extends Exception {
-
- /**
- * Creates a new instance of MailTemplateException without
- * detail message.
- */
- public MailTemplateException() {
- }
-
- /**
- * Constructs an instance of MailTemplateException with the
- * specified detail message.
- *
- * @param msg the detail message.
- */
- public MailTemplateException(String msg) {
- super(msg);
- }
-
- /**
- * Constructs an instance of MailTemplateException with the
- * specified detail message.
- *
- * @param msg the detail message.
- * @param th the root cause
- */
- public MailTemplateException(String msg, Throwable th) {
- super(msg, th);
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/presentation/LoginView.java b/account/src/main/java/de/muehlencord/shared/account/presentation/LoginView.java
deleted file mode 100644
index e075040..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/presentation/LoginView.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.presentation;
-
-import de.muehlencord.shared.account.business.account.control.AccountControl;
-import de.muehlencord.shared.account.business.account.entity.AccountEntity;
-import de.muehlencord.shared.jeeutil.FacesUtil;
-import java.io.IOException;
-import java.io.Serializable;
-import javax.ejb.EJB;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.view.ViewScoped;
-import javax.inject.Named;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.authc.AuthenticationException;
-import org.apache.shiro.authc.UsernamePasswordToken;
-import org.apache.shiro.subject.Subject;
-import org.apache.shiro.web.util.WebUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author joern.muehlencord
- */
-@Named(value = "loginView")
-@ViewScoped
-public class LoginView implements Serializable {
-
- private static final long serialVersionUID = -1164860380769648432L;
-
- @EJB
- private AccountControl accountService;
-
- private String username = null;
- private String password = null;
- private boolean rememberMe = false;
-
- private String resetPasswordToken = null;
-
- private static final Logger LOGGER = LoggerFactory.getLogger(LoginView.class.getName());
-
- public void authenticate() {
-
- // Example using most common scenario of username/password pair:
- UsernamePasswordToken token = new UsernamePasswordToken(getUsername(), getPassword());
-
- // "Remember Me" built-in:
- token.setRememberMe(rememberMe);
- Subject currentUser = SecurityUtils.getSubject();
- LOGGER.info("Trying to login user {}", username);
-
- try {
- currentUser.login(token);
- LOGGER.info("User {} logged in", username);
- // user logged in, update account entity
- AccountEntity account = accountService.getAccountEntity(username, true);
- accountService.updateLogin(account);
-
- // redirect to home
- ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
- ServletResponse servletResponse = (ServletResponse) ec.getResponse();
- String fallbackUrl = "/web/index.xhtml"; // TODO make configurable
- // ec.redirect(url);
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("redirecting to {}, fallbackUrl={}", servletResponse.toString(), fallbackUrl);
- }
-
- WebUtils.redirectToSavedRequest((ServletRequest) ec.getRequest(), servletResponse, fallbackUrl);
- } catch (IOException | AuthenticationException ex) {
- // Could catch a subclass of AuthenticationException if you like
- String hint = "Error while authenticating user " + username;
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug(hint, ex);
- }
-
- if (ex.getMessage() != null) {
- hint += "Reason: " + ex.getMessage();
- } else {
- hint += "Reason: " + ex.toString();
- }
- if ((ex.getCause() != null) && (ex.getCause().getMessage() != null)) {
- hint += "Rootcause: " + ex.getMessage();
-
- LOGGER.error(hint);
- }
- FacesUtil.addGlobalErrorMessage("Login failed", hint);
-
- AccountEntity account = accountService.getAccountEntity(username, false);
- if (account != null) {
- accountService.addLoginError(account);
- }
- } finally {
- token.clear();
- }
- }
-
- public void logout() {
- Subject currentUser = SecurityUtils.getSubject();
- try {
- currentUser.logout();
-
- ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
-
- // ensure faces session is invalidated so beans are destroyed
- ec.invalidateSession();
-
- // check if redirect shall be executed
- // default setting is yes to /login.xhtml
- // can be overwritten using parameters
- // de.muehlencord.shared.account.loginview.executeredirect boolean true/false
- // de.muehlencord.shared.account.loginview.redirecttarget path to redirect to (without external context, will be added automatically)
- String executeRedirectString = ec.getInitParameter("de.muehlencord.shared.account.loginview.executeredirect");
- boolean executeRedirect = true;
- if (executeRedirectString != null) {
- executeRedirect = Boolean.parseBoolean(executeRedirectString);
- }
-
- String redirectTarget = ec.getInitParameter("de.muehlencord.shared.account.loginview.redirecttarget");
- if ((redirectTarget == null) || (redirectTarget.equals(""))) {
- redirectTarget = "/login.xhtml";
- }
-
- if (executeRedirect) {
- String url = ec.getRequestContextPath() + redirectTarget;
- ec.redirect(url);
- }
-
- } catch (Exception e) {
- LOGGER.warn(e.toString());
- }
- }
-
- public String executePasswordReset() {
- boolean passwordResetted = accountService.resetPassword(username, password, resetPasswordToken);
- if (passwordResetted) {
- // TODO add email notification on updated user account
- FacesUtil.addGlobalInfoMessage("Password resetted", null);
- return login();
- } else {
- // TODO add email notificaton on failed password reset
- FacesUtil.addGlobalErrorMessage("Password reset failed", null);
- return login();
- }
- }
-
- /* **** naviation rules **** */
- public String login() {
- return "/login.xhtml"; // TODO make configurable
- }
-
- /* *** getter / setter */
- public String getUsername() {
- return username;
- }
-
- public void setUsername(String un) {
- this.username = un;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String pw) {
- this.password = pw;
- }
-
- public boolean isRememberMe() {
- return rememberMe;
- }
-
- public void setRememberMe(boolean rememberMe) {
- this.rememberMe = rememberMe;
- }
-
- public String getResetPasswordToken() {
- return resetPasswordToken;
- }
-
- public void setResetPasswordToken(String resetPasswordToken) {
- this.resetPasswordToken = resetPasswordToken;
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/presentation/LostPasswordView.java b/account/src/main/java/de/muehlencord/shared/account/presentation/LostPasswordView.java
deleted file mode 100644
index a74162f..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/presentation/LostPasswordView.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.presentation;
-
-import de.muehlencord.shared.account.business.account.control.AccountControl;
-import de.muehlencord.shared.jeeutil.FacesUtil;
-import java.io.Serializable;
-import javax.ejb.EJB;
-import javax.faces.view.ViewScoped;
-import javax.inject.Named;
-
-/**
- *
- * @author joern@muehlencord.de
- */
-@Named (value = "lostPasswordView")
-@ViewScoped
-public class LostPasswordView implements Serializable {
-
- private static final long serialVersionUID = -1793445795465830069L;
-
- @EJB
- private AccountControl accountService;
-
- private String userName;
- private boolean passwordResetStarted = false;
-
- public String initPasswordReset() {
- if (accountService.initPasswordReset(userName)) {
- passwordResetStarted = true;
- FacesUtil.addGlobalInfoMessage("Password reset started.", "Please check your email account.");
- } else {
- FacesUtil.addGlobalErrorMessage("Error while resetting password.", "Please contact your administrator.");
- }
- return "/login.xhtml"; // TODO make configurable, get from LoginView?
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public boolean getPasswordResetStarted() {
- return passwordResetStarted;
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/shiro/authc/JwtMatcher.java b/account/src/main/java/de/muehlencord/shared/account/shiro/authc/JwtMatcher.java
deleted file mode 100644
index 1d17ba2..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/shiro/authc/JwtMatcher.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.shiro.authc;
-
-import de.muehlencord.shared.account.business.account.boundary.ApiKeyService;
-import de.muehlencord.shared.account.business.account.entity.JWTObject;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.apache.shiro.authc.AuthenticationInfo;
-import org.apache.shiro.authc.AuthenticationToken;
-import org.apache.shiro.authc.credential.CredentialsMatcher;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author joern.muehlencord
- */
-public class JwtMatcher implements CredentialsMatcher {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(JwtMatcher.class);
- private final ApiKeyService apiKeyService = lookupApiKeyServiceBean();
-
- @Override
- public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {
- if (token == null) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("No token available - cannot match credentials");
- }
- return false;
- }
-
- if ((info == null) || (info.getCredentials() == null)) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("No authenticationInfo available - cannot match credentials");
- }
- return false;
- }
-
- Object submittedJwtObj = token.getCredentials();
- Object storedCredentials = getStoredPassword(info);
- if ((submittedJwtObj != null) && (submittedJwtObj.getClass().isAssignableFrom(String.class))) {
- String submittedJwt = (String) submittedJwtObj;
- if (apiKeyService.validateJWT(submittedJwt)) {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("JWT is valid, checking if it comes from the correct user");
- }
-
- JWTObject jwtObject = apiKeyService.getJWTObject(submittedJwt);
- String storedUsername = info.getPrincipals().getPrimaryPrincipal().toString();
- if (jwtObject.getUserName().equals(storedUsername)) {
- if (jwtObject.getUnqiueId().equals (storedCredentials)) {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("JWT matches user and password is correct");
- }
- return true;
- } else {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("JWT password does not match provided password");
- }
- return false;
- }
- } else {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("JWT belongs to user {}, but authinfo is from user {} - JWT does not match");
- }
- return false;
- }
- } else {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("JWT is invalid");
- }
- return false;
- }
- } else {
- LOGGER.error("Unexpected authInfoFormat - please check your configuration");
- return false;
- }
- }
-
- protected Object getStoredPassword(AuthenticationInfo storedAccountInfo) {
- Object stored = storedAccountInfo != null ? storedAccountInfo.getCredentials() : null;
- //fix for https://issues.apache.org/jira/browse/SHIRO-363
- if (stored instanceof char[]) {
- stored = new String((char[]) stored);
- }
- return stored;
- }
-
- // TODO - can this be injected?
- private ApiKeyService lookupApiKeyServiceBean() {
- try {
- Context c = new InitialContext();
- return (ApiKeyService) c.lookup("java:module/ApiKeyService"); // NOI18N
- } catch (NamingException ex) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug(ex.toString(), ex);
- } else {
- LOGGER.error(ex.toString());
- }
- throw new RuntimeException(ex);
- }
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/shiro/filter/JWTAuthenticationFilter.java b/account/src/main/java/de/muehlencord/shared/account/shiro/filter/JWTAuthenticationFilter.java
deleted file mode 100644
index 8d612a9..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/shiro/filter/JWTAuthenticationFilter.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.shiro.filter;
-
-import de.muehlencord.shared.account.business.account.boundary.ApiKeyService;
-import de.muehlencord.shared.account.business.account.entity.JWTObject;
-import de.muehlencord.shared.account.shiro.token.JWTAuthenticationToken;
-import de.muehlencord.shared.account.util.AccountSecurityException;
-import de.muehlencord.shared.jeeutil.restexfw.APIException;
-import java.io.IOException;
-import java.io.StringReader;
-import javax.json.Json;
-import javax.json.JsonObject;
-import javax.json.JsonReader;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.io.IOUtils;
-import org.apache.shiro.authc.AuthenticationToken;
-import org.apache.shiro.authc.UsernamePasswordToken;
-import org.apache.shiro.web.filter.authc.AuthenticatingFilter;
-import org.apache.shiro.web.util.WebUtils;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Joern Muehlencord
- */
-public final class JWTAuthenticationFilter extends AuthenticatingFilter {
-
- private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(JWTAuthenticationFilter.class);
- protected static final String AUTHORIZATION_HEADER = "Authorization"; // NOI18N
- protected static final String USERNAME = "username"; // NOI18N
- protected static final String PASSWORD = "password"; // NOI18N
-
- private final ApiKeyService apiKeyService = lookupApiKeyServiceBean();
-
- public JWTAuthenticationFilter() {
- // FIXME - logging in via JWTAuthenticationFilter does not yet work. Need to set login to anonymous to execute login in rest service
- setLoginUrl("/rest/account/login");
- }
-
- @Override
- protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {
- boolean loggedIn = false;
-
- if (isLoginRequest(request, response) || isLoggedAttempt(request, response)) {
- loggedIn = executeLogin(request, response);
- }
-
- if (!loggedIn) {
- HttpServletResponse httpResponse = WebUtils.toHttp(response);
- httpResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
- }
-
- return loggedIn;
- }
-
- @Override
- protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception {
- if (isLoginRequest(request, response)) {
- String json = IOUtils.toString(request.getInputStream(), "UTF-8"); // FIXME - check charset in request
-
- if (json != null && !json.isEmpty()) {
- try (JsonReader jr = Json.createReader(new StringReader(json))) {
- JsonObject object = jr.readObject();
- String username = object.getString(USERNAME);
- String password = object.getString(PASSWORD);
- return new UsernamePasswordToken(username, password);
- }
-
- }
- }
-
- if (isLoggedAttempt(request, response)) {
- String jwtToken = getAuthzHeader(request);
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("found jwtToken in header = {}", jwtToken);
- }
-
- if (jwtToken != null) {
- JWTObject jwtObject = apiKeyService.getJWTObject(jwtToken);
- return new JWTAuthenticationToken(jwtObject.getUserName(), jwtToken);
- }
- }
-
- return new UsernamePasswordToken();
- }
-
- private boolean isLoggedAttempt(ServletRequest request, ServletResponse response) {
- String authzHeader = getAuthzHeader(request);
- return authzHeader != null;
- }
-
- private String getAuthzHeader(ServletRequest request) {
- HttpServletRequest httpRequest = WebUtils.toHttp(request);
- return httpRequest.getHeader(AUTHORIZATION_HEADER);
- }
-
-
- /**
- * Overwrite cleanup to ensure no exception is thrown if an
- * AccountSecurityException / APIException is raised during login. As long
- * as the user is not logged in JERSEYs ExceptionMapper and intercepor
- * classes are overruled by Shiro.
- *
- * @param request the incoming request
- * @param response the response to return
- * @param existing the raised exception
- * @throws ServletException may be thrown by AuthenticatingFilter.cleanup if
- * existing is not a AccountSecurityException
- * @throws IOException may be thrown by AuthenticatingFilter.cleanup if
- * existing is not a AccountSecurityException
- */
- @Override
- protected void cleanup(ServletRequest request, ServletResponse response, Exception existing) throws ServletException, IOException {
- if ((existing != null) && (existing.getClass().isAssignableFrom(AccountSecurityException.class))) {
- HttpServletResponse httpResponse = WebUtils.toHttp(response);
- httpResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
- } else if ((existing != null) && (existing.getClass().isAssignableFrom(APIException.class))) {
- APIException apiException = (APIException) existing;
-
- HttpServletResponse httpResponse = WebUtils.toHttp(response);
- httpResponse.setStatus(apiException.getHttpResponse().getStatus());
- httpResponse.addHeader(APIException.HTTP_HEADER_X_ERROR, apiException.getHttpResponse().getHeaderString(APIException.HTTP_HEADER_X_ERROR));
- httpResponse.addHeader(APIException.HTTP_HEADER_X_ERROR_CODE, apiException.getHttpResponse().getHeaderString(APIException.HTTP_HEADER_X_ERROR_CODE));
-
- if (apiException.getHttpResponse().getHeaderString(APIException.HTTP_HEADER_X_ROOT_CAUSE) != null) {
- httpResponse.addHeader(APIException.HTTP_HEADER_X_ROOT_CAUSE, apiException.getHttpResponse().getHeaderString(APIException.HTTP_HEADER_X_ROOT_CAUSE));
- }
- } else {
- super.cleanup(request, response, existing);
- }
- }
-
- // TODO - can this be injected?
- private ApiKeyService lookupApiKeyServiceBean() {
- try {
- Context c = new InitialContext();
- return (ApiKeyService) c.lookup("java:module/ApiKeyService"); // NOI18N
- } catch (NamingException ex) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug(ex.toString(), ex);
- } else {
- LOGGER.error(ex.toString());
- }
- throw new RuntimeException(ex);
- }
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/shiro/pam/AllSupportedSuccessfulStrategy.java b/account/src/main/java/de/muehlencord/shared/account/shiro/pam/AllSupportedSuccessfulStrategy.java
deleted file mode 100644
index 2768393..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/shiro/pam/AllSupportedSuccessfulStrategy.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2019 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.shiro.pam;
-
-import org.apache.shiro.authc.AuthenticationException;
-import org.apache.shiro.authc.AuthenticationInfo;
-import org.apache.shiro.authc.AuthenticationToken;
-import org.apache.shiro.authc.UnknownAccountException;
-import org.apache.shiro.authc.pam.AbstractAuthenticationStrategy;
-import org.apache.shiro.realm.Realm;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author joern.muehlencord
- */
-public class AllSupportedSuccessfulStrategy extends AbstractAuthenticationStrategy {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(AllSupportedSuccessfulStrategy.class);
-
- public AuthenticationInfo beforeAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo info) throws AuthenticationException {
- if (!realm.supports(token)) {
- return info;
- }
-
- return info;
- }
-
- public AuthenticationInfo afterAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo info, AuthenticationInfo aggregate, Throwable t)
- throws AuthenticationException {
- if (t != null) {
- if (t instanceof AuthenticationException) {
- //propagate:
- throw ((AuthenticationException) t);
- } else {
- String msg = "Unable to acquire account data from realm [" + realm + "]. The ["
- + getClass().getName() + " implementation requires all configured realm(s) to operate successfully "
- + "for a successful authentication.";
- throw new AuthenticationException(msg, t);
- }
- }
- if (info == null) {
- if (realm.supports(token)) {
- String msg = "Realm [" + realm + "] could not find any associated account data for the submitted "
- + "AuthenticationToken [" + token + "]. The [" + getClass().getName() + "] implementation requires "
- + "all configured realm(s) to acquire valid account data for a submitted token during the "
- + "log-in process.";
- throw new UnknownAccountException(msg);
- } else {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Realm [{}] does not support token of type [{}], skipped realm", realm, token);
- }
- }
- } else {
- LOGGER.debug("Account successfully authenticated using realm [{}]", realm);
- }
-
- // If non-null account is returned, then the realm was able to authenticate the
- // user - so merge the account with any accumulated before
- // if the realm does not support the token, null is returned
- if (realm.supports(token)) {
- merge(info, aggregate);
- }
-
- return aggregate;
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/shiro/realm/AccountRealm.java b/account/src/main/java/de/muehlencord/shared/account/shiro/realm/AccountRealm.java
deleted file mode 100644
index d5f76c7..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/shiro/realm/AccountRealm.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.shiro.realm;
-
-import de.muehlencord.shared.account.shiro.authc.JwtMatcher;
-import de.muehlencord.shared.account.shiro.token.JWTAuthenticationToken;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.UUID;
-import org.apache.shiro.authc.AccountException;
-import org.apache.shiro.authc.AuthenticationException;
-import org.apache.shiro.authc.AuthenticationInfo;
-import org.apache.shiro.authc.AuthenticationToken;
-import org.apache.shiro.authc.IncorrectCredentialsException;
-import org.apache.shiro.authc.SimpleAuthenticationInfo;
-import org.apache.shiro.authc.UnknownAccountException;
-import org.apache.shiro.authc.UsernamePasswordToken;
-import org.apache.shiro.authc.credential.AllowAllCredentialsMatcher;
-import org.apache.shiro.authc.credential.CredentialsMatcher;
-import org.apache.shiro.realm.jdbc.JdbcRealm;
-import org.apache.shiro.util.JdbcUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author joern.muehlencord
- */
-public class AccountRealm extends JdbcRealm {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(AccountRealm.class);
-
- protected String applicationId = null;
- protected String jwtAuthenticationQuery = "select ak.api_key from account a, api_key ak where ak.account = a.id and a.username = ? and a.status not in ('BLOCKED','DELETED','DISABLED') ORDER BY ak.issued_on ASC";
- protected CredentialsMatcher jwtMatcher = new JwtMatcher();
-
- public AccountRealm() {
- this.authenticationQuery = "select al.account_password from account a, account_login al where al.account = a.id and a.username = ? and status not in ('BLOCKED','DELETED','DISABLED')";
- this.userRolesQuery = "select r.role_name from application_role r, account_role ar, account a WHERE a.username = ? AND a.id = ar.account AND ar.account_role = r.id AND r.application = ?";
- this.permissionsQuery = "select permission_name from application_role appr, role_permission rp, application_permission appp WHERE appr.role_name = ? AND appr.application = ? AND rp.application_role = appr.id AND rp.role_permission = appp.id";
- this.permissionsLookupEnabled = true;
- }
-
- @Override
- public boolean supports(AuthenticationToken token) {
- return (token != null && ((JWTAuthenticationToken.class.isAssignableFrom(token.getClass())) || (UsernamePasswordToken.class.isAssignableFrom(token.getClass()))));
- }
-
- @Override
- protected Set getRoleNamesForUser(Connection conn, String username) throws SQLException {
- PreparedStatement ps = null;
- ResultSet rs = null;
- Set roleNames = new LinkedHashSet<>();
- try {
- ps = conn.prepareStatement(userRolesQuery);
- ps.setString(1, username);
- ps.setObject(2, UUID.fromString(applicationId)); // this is the changed line - rest is the same as in JDBCRealm
-
- // Execute query
- rs = ps.executeQuery();
-
- // Loop over results and add each returned role to a set
- while (rs.next()) {
-
- String roleName = rs.getString(1);
-
- // Add the role to the list of names if it isn't null
- if (roleName != null) {
- roleNames.add(roleName);
- } else {
- LOGGER.error("Null role name found while retrieving role names for user [{}]", username);
- }
- }
- } finally {
- JdbcUtils.closeResultSet(rs);
- JdbcUtils.closeStatement(ps);
- }
- return roleNames;
- }
-
- /**
- * overwritten getPermissions. Only change is to inject the applicationId
- * into the the query
- *
- * @param conn the connection to use
- * @param username the user to lookup
- * @param roleNames the users roles
- * @return a list of permissions
- * @throws SQLException if the SQL query fails
- */
- @Override
- protected Set getPermissions(Connection conn, String username, Collection roleNames) throws SQLException {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("user {} has the following roles: {}", username, roleNames.toString());
- LOGGER.debug("looking up permissions for user");
- }
-
- PreparedStatement ps = null;
- Set permissions = new LinkedHashSet<>();
- try {
- ps = conn.prepareStatement(permissionsQuery);
- for (String roleName : roleNames) {
-
- ps.setString(1, roleName);
- ps.setObject(2, UUID.fromString(applicationId)); // this is the changed line - rest is the same as in JDBCRealm
-
- ResultSet rs = null;
- try {
- // Execute query
- rs = ps.executeQuery();
- // Loop over results and add each returned role to a set
- while (rs.next()) {
- String permissionString = rs.getString(1);
- // Add the permission to the set of permissions
- permissions.add(permissionString);
- }
- } finally {
- JdbcUtils.closeResultSet(rs);
- }
-
- }
- } finally {
- JdbcUtils.closeStatement(ps);
- }
-
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("user {} has the following permissions: {}", username, permissions.toString());
- }
-
- return permissions;
- }
-
- public boolean isJwtAuthentication(AuthenticationToken token) {
- if (token == null) {
- throw new AuthenticationException("empty tokens are not supported by this realm");
- }
-
- if (token.getClass().isAssignableFrom(JWTAuthenticationToken.class)) {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("Handling JWTAuthenticationToken");
- }
- return true;
- } else if (token.getClass().isAssignableFrom(UsernamePasswordToken.class)) {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("Handling UsernamePasswordToken");
- }
- return false;
- } else {
- throw new AuthenticationException("Handling of " + token.getClass() + " not supported by this realm");
- }
- }
-
- @Override
- protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
- if (isJwtAuthentication(token)) {
- return doGetJwtAuthenticationInfo(token);
- } else {
- return super.doGetAuthenticationInfo(token);
- }
- }
-
- protected AuthenticationInfo doGetJwtAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
- JWTAuthenticationToken jwtToken = (JWTAuthenticationToken) token;
- String username = jwtToken.getUserName();
-
- // Null username is invalid
- if (username == null) {
- throw new AccountException("Null usernames are not allowed by this realm.");
- }
-
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Checking JWT for user {}", username);
- }
-
- Connection conn = null;
- SimpleAuthenticationInfo info = null;
- try {
- conn = dataSource.getConnection();
-
- String apiKey = getApiKeyForJwtUser(conn, username);
-
- if (apiKey == null) {
- throw new UnknownAccountException("No api key found for user [" + username + "]");
- }
-
- info = new SimpleAuthenticationInfo(username, apiKey.toCharArray(), getName());
-
- } catch (SQLException ex) {
- final String message = "There was a SQL error while authenticating user [" + username + "]";
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug(message, ex);
- } else {
- LOGGER.error(ex.toString());
- }
- // Rethrow any SQL errors as an authentication exception
- throw new AuthenticationException(message, ex);
- } finally {
- JdbcUtils.closeConnection(conn);
- }
-
- return info;
- }
-
- private String getApiKeyForJwtUser(Connection conn, String username) throws SQLException {
-
- String result = null;
-
- PreparedStatement ps = null;
- ResultSet rs = null;
- try {
- ps = conn.prepareStatement(jwtAuthenticationQuery);
- ps.setString(1, username);
-
- // Execute query
- rs = ps.executeQuery();
- // loop through result, take last one (by default ordered by issue date ASC)
- // we only expect one - application should delete all obsolete ones automatically
- while (rs.next()) {
- result = rs.getString(1);
- }
- } finally {
- JdbcUtils.closeResultSet(rs);
- JdbcUtils.closeStatement(ps);
- }
-
- return result;
- }
-
- /**
- * Asserts that the submitted {@code AuthenticationToken}'s credentials
- * match the stored account {@code AuthenticationInfo}'s credentials, and if
- * not, throws an {@link AuthenticationException}.
- *
- * @param token the submitted authentication token
- * @param info the AuthenticationInfo corresponding to the given
- * {@code token}
- * @throws AuthenticationException if the token's credentials do not match
- * the stored account credentials.
- */
- @Override
- protected void assertCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) throws AuthenticationException {
- CredentialsMatcher cm;
- if (isJwtAuthentication(token)) {
- cm = getJwtMatcher();
- } else {
- cm = getCredentialsMatcher();
- }
-
- if (cm != null) {
- if (!cm.doCredentialsMatch(token, info)) {
- //not successful - throw an exception to indicate this:
- String msg = "Submitted credentials for token [" + token + "] did not match the expected credentials.";
- throw new IncorrectCredentialsException(msg);
- }
- } else {
- throw new AuthenticationException("A CredentialsMatcher must be configured in order to verify "
- + "credentials during authentication. If you do not wish for credentials to be examined, you "
- + "can configure an " + AllowAllCredentialsMatcher.class.getName() + " instance.");
- }
- }
-
- /* *** getter / setter *** */
- public String getApplicationId() {
- return this.applicationId;
- }
-
- public void setApplicationId(String applicationId) {
- this.applicationId = applicationId;
- }
-
- public String getJwtAuthenticationQuery() {
- return jwtAuthenticationQuery;
- }
-
- public void setJwtAuthenticationQuery(String jwtAuthenticationQuery) {
- this.jwtAuthenticationQuery = jwtAuthenticationQuery;
- }
-
- public CredentialsMatcher getJwtMatcher() {
- return jwtMatcher;
- }
-
- public void setJwtMatcher(CredentialsMatcher jwtMatcher) {
- this.jwtMatcher = jwtMatcher;
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/shiro/realm/UserNameActiveDirectoryRealm.java b/account/src/main/java/de/muehlencord/shared/account/shiro/realm/UserNameActiveDirectoryRealm.java
deleted file mode 100644
index 7f0b1a9..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/shiro/realm/UserNameActiveDirectoryRealm.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.shiro.realm;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import javax.naming.NamingException;
-import javax.naming.ldap.LdapContext;
-import org.apache.shiro.authc.AuthenticationInfo;
-import org.apache.shiro.authc.AuthenticationToken;
-import org.apache.shiro.authc.UsernamePasswordToken;
-import org.apache.shiro.authz.AuthorizationInfo;
-import org.apache.shiro.realm.activedirectory.ActiveDirectoryRealm;
-import org.apache.shiro.realm.ldap.LdapContextFactory;
-import org.apache.shiro.realm.ldap.LdapUtils;
-import org.apache.shiro.subject.PrincipalCollection;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author joern.muehlencord
- */
-public class UserNameActiveDirectoryRealm extends ActiveDirectoryRealm {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(UserNameActiveDirectoryRealm.class);
-
- private boolean permissionsLookupEnabled = true;
- protected List fallbackPrincipalSuffixes = null;
- private NamingException lastException = null;
-
- @Override
- public boolean supports(AuthenticationToken token) {
- return (token != null && (UsernamePasswordToken.class.isAssignableFrom(token.getClass())));
- }
-
- @Override
- protected AuthenticationInfo queryForAuthenticationInfo(AuthenticationToken token, LdapContextFactory ldapContextFactory) throws NamingException {
- UsernamePasswordToken upToken = (UsernamePasswordToken) token;
- String userName = upToken.getUsername();
- LdapContext ctx = lookupUserWithSuffix(upToken, ldapContextFactory, principalSuffix);
-
- if (fallbackPrincipalSuffixes != null) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Trying the fallbackSuffixes = {}", fallbackPrincipalSuffixes.toString());
- }
-
- Iterator it = fallbackPrincipalSuffixes.iterator();
- while ((ctx == null) && (it.hasNext())) {
- ctx = lookupUserWithSuffix(upToken, ldapContextFactory, it.next());
- }
- }
-
- if (ctx == null) {
- if (lastException != null) {
- throw lastException;
- } else {
- throw new NamingException("Unknown error authenticationing user " + userName + ". Context still null. Check implementation");
- }
- }
-
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("User {} LDAP authenticated", userName);
- LOGGER.debug("building authentication info");
- }
- AuthenticationInfo authInfo = buildAuthenticationInfo(userName, upToken.getPassword());
-
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("authentifaction info created");
- }
-
- return authInfo;
- }
-
- /**
- * Builds an {@link org.apache.shiro.authz.AuthorizationInfo} object by querying the active directory LDAP context for the groups that a user is a member of. The groups are then translated to role
- * names by using the configured {@link #groupRolesMap}.
- *
- * This implementation expects the principal argument to be a String username.
- *
- * Subclasses can override this method to determine authorization data (roles, permissions, etc) in a more complex way. Note that this default implementation does not support permissions, only
- * roles.
- *
- * @param principals the principal of the Subject whose account is being retrieved.
- * @param ldapContextFactory the factory used to create LDAP connections.
- * @return the AuthorizationInfo for the given Subject principal.
- * @throws NamingException if an error occurs when searching the LDAP server.
- */
- @Override
- protected AuthorizationInfo queryForAuthorizationInfo(PrincipalCollection principals, LdapContextFactory ldapContextFactory) throws NamingException {
- Set roleNames;
- if (this.permissionsLookupEnabled) {
- String username = (String) getAvailablePrincipal(principals);
- // Perform context search
- LdapContext ldapContext = ldapContextFactory.getSystemLdapContext();
- try {
- roleNames = getRoleNamesForUser(username, ldapContext);
- } finally {
- LdapUtils.closeContext(ldapContext);
- }
- } else {
- roleNames = new HashSet<>();
- }
- return buildAuthorizationInfo(roleNames);
- }
-
- public boolean isPermissionsLookupEnabled() {
- return permissionsLookupEnabled;
- }
-
- public void setPermissionsLookupEnabled(boolean permissionsLookupEnabled) {
- this.permissionsLookupEnabled = permissionsLookupEnabled;
- }
-
- public List getFallbackPrincipalSuffixes() {
- return fallbackPrincipalSuffixes;
- }
-
- public void setFallbackPrincipalSuffixes(List fallbackPrincipalSuffixes) {
- this.fallbackPrincipalSuffixes = fallbackPrincipalSuffixes;
- }
-
- private String getUserName(UsernamePasswordToken upToken, String suffix) {
- String userName = upToken.getUsername();
- if (suffix != null) {
- if (!userName.contains(suffix)) {
- userName += suffix;
- }
- }
- return userName;
- }
-
- private LdapContext lookupUser(String userName, Object credentials, LdapContextFactory ldapContextFactory) throws NamingException {
-
- // Binds using the username and password provided by the user.
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("start creating context");
- }
- return ldapContextFactory.getLdapContext(userName, credentials);
- }
-
- private LdapContext lookupUserWithSuffix(UsernamePasswordToken upToken, LdapContextFactory ldapContextFactory, String currentSuffix) {
- String userName = getUserName(upToken, currentSuffix);
- LdapContext ctx = null;
- try {
- ctx = lookupUser(userName, upToken.getCredentials(), ldapContextFactory);
- } catch (NamingException ex) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Lookup with suffix {} failed", currentSuffix);
- }
- if (LOGGER.isTraceEnabled()) {
- LOGGER.error(ex.getMessage());
- LOGGER.trace("Detailed stacktrace", new Object[]{ex});
- }
-
- lastException = ex;
- return null;
- } finally {
- LdapUtils.closeContext(ctx);
- }
- return ctx;
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/shiro/token/JWTAuthenticationToken.java b/account/src/main/java/de/muehlencord/shared/account/shiro/token/JWTAuthenticationToken.java
deleted file mode 100644
index a305718..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/shiro/token/JWTAuthenticationToken.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.shiro.token;
-
-import org.apache.shiro.authc.AuthenticationToken;
-
-/**
- *
- * @author joern.muehlencord
- */
-public class JWTAuthenticationToken implements AuthenticationToken {
-
- private String userName;
- private String token;
-
- public JWTAuthenticationToken(String userId, String token) {
- this.userName = userId;
- this.token = token;
- }
-
- @Override
- public String getPrincipal() {
- return getUserName();
- }
-
- @Override
- public String getCredentials() {
- return getToken();
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userId) {
- this.userName = userId;
- }
-
- public String getToken() {
- return token;
- }
-
- public void setToken(String token) {
- this.token = token;
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/util/AccountPU.java b/account/src/main/java/de/muehlencord/shared/account/util/AccountPU.java
deleted file mode 100644
index 58871dc..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/util/AccountPU.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.util;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import javax.inject.Qualifier;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@Qualifier
-@Retention(RUNTIME)
-@Target({METHOD, FIELD, PARAMETER, TYPE})
-public @interface AccountPU {
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/util/AccountSecurityException.java b/account/src/main/java/de/muehlencord/shared/account/util/AccountSecurityException.java
deleted file mode 100644
index fec89d4..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/util/AccountSecurityException.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.util;
-
-import java.io.Serializable;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-/**
- *
- * @author Joern Muehlencord
- */
-public class AccountSecurityException extends Exception implements Serializable {
-
- private static final long serialVersionUID = 8135850463689587815L;
-
- private final SecurityError securityError;
-
- public AccountSecurityException(SecurityError securityError) {
- this.securityError = securityError;
- }
-
- public String getErrorCode() {
- return securityError.getErrorCode();
- }
-
- public String getMessageKey() {
- return securityError.getMessageKey();
- }
-
- public String getMessage() {
- ResourceBundle resourceBundle = ResourceBundle.getBundle(securityError.getClass().getName(), Locale.ENGLISH);
- return resourceBundle.getString(securityError.getMessageKey());
- }
-
- public String getLocalizedMessage(Locale locale) {
- ResourceBundle resourceBundle = ResourceBundle.getBundle(securityError.getClass().getName(), locale);
- return resourceBundle.getString(securityError.getMessageKey());
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/util/AccountSecurityExceptionMapper.java b/account/src/main/java/de/muehlencord/shared/account/util/AccountSecurityExceptionMapper.java
deleted file mode 100644
index df65b35..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/util/AccountSecurityExceptionMapper.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.util;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-
-/**
- *
- * @author joern.muehlencord
- */
-public class AccountSecurityExceptionMapper implements ExceptionMapper {
-
- @Override
- public Response toResponse(AccountSecurityException ex) {
- return Response.status(Response.Status.UNAUTHORIZED).entity(ex.getMessage()).build();
- }
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/util/AccountTransactionJoinInterceptor.java b/account/src/main/java/de/muehlencord/shared/account/util/AccountTransactionJoinInterceptor.java
deleted file mode 100644
index fde601a..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/util/AccountTransactionJoinInterceptor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.util;
-
-import javax.annotation.Priority;
-import javax.inject.Inject;
-import javax.interceptor.AroundInvoke;
-import javax.interceptor.Interceptor;
-import javax.interceptor.InvocationContext;
-import javax.persistence.EntityManager;
-import javax.transaction.Transactional;
-import static javax.transaction.Transactional.TxType.REQUIRED;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@Transactional(value = REQUIRED)
-@Interceptor
-@Priority(value = AccountTransactionJoinInterceptor.PRIORITY)
-public class AccountTransactionJoinInterceptor {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(AccountTransactionJoinInterceptor.class);
-
- // attach behind the interceptor of the container
- public static final int PRIORITY = Interceptor.Priority.PLATFORM_BEFORE + 250;
-
- @Inject
- @AccountPU
- private EntityManager em;
-
- @AroundInvoke
- public Object joinTransaction(InvocationContext context) throws Exception {
- if (em == null) {
- return context.proceed();
- } else {
- if (em.isJoinedToTransaction()) {
- LOGGER.trace("transaction already joined");
- } else {
- LOGGER.trace("joining transaction");
- em.joinTransaction();
- }
- }
- return context.proceed();
- }
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/util/Permission.java b/account/src/main/java/de/muehlencord/shared/account/util/Permission.java
deleted file mode 100644
index e563e03..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/util/Permission.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.util;
-
-/**
- *
- * @author Joern Muehlencord
- */
-public interface Permission {
-
- String getName();
- String getDescription();
-
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/util/SecurityError.java b/account/src/main/java/de/muehlencord/shared/account/util/SecurityError.java
deleted file mode 100644
index 5451318..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/util/SecurityError.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.util;
-
-/**
- *
- * @author Joern Muehlencord
- */
-public interface SecurityError {
-
- String getErrorCode();
- String getMessageKey();
-
-}
diff --git a/account/src/main/java/de/muehlencord/shared/account/util/SecurityUtil.java b/account/src/main/java/de/muehlencord/shared/account/util/SecurityUtil.java
deleted file mode 100644
index 827faab..0000000
--- a/account/src/main/java/de/muehlencord/shared/account/util/SecurityUtil.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.util;
-
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.authc.credential.DefaultPasswordService;
-import org.apache.shiro.crypto.hash.DefaultHashService;
-import org.apache.shiro.crypto.hash.Sha512Hash;
-import org.apache.shiro.subject.Subject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author jomu
- */
-public class SecurityUtil {
-
- private final static Logger LOGGER = LoggerFactory.getLogger(SecurityUtil.class.getName());
-
- public static String createPassword(String clearTextPassword) {
- // TODO read values from shiro.ini
- DefaultHashService hashService = new DefaultHashService();
- hashService.setHashIterations(500000); //
- hashService.setHashAlgorithmName(Sha512Hash.ALGORITHM_NAME);
- hashService.setGeneratePublicSalt(true);
-
- DefaultPasswordService passwordService = new DefaultPasswordService();
- passwordService.setHashService(hashService);
-
- // try to encrypt password
- String encryptedPassword = passwordService.encryptPassword(clearTextPassword);
- LOGGER.trace(encryptedPassword);
- return encryptedPassword;
- }
-
- public static boolean checkPermission(Permission permission) {
- return checkPermission (permission.getName());
- }
-
- public static boolean checkPermission(String permissionName) {
- Subject currentUser = SecurityUtils.getSubject();
- if ((currentUser == null) || (!currentUser.isAuthenticated())) {
- return false;
- }
-
- String requiredPermissions = permissionName;
- return currentUser.isPermitted(requiredPermissions);
- }
-
- public static void checkPermission(Permission permission, SecurityError error) throws AccountSecurityException {
- if (!checkPermission(permission)) {
- throw new AccountSecurityException(error);
- }
- }
-
-}
diff --git a/account/src/main/resources/META-INF/persistence.xml b/account/src/main/resources/META-INF/persistence.xml
deleted file mode 100644
index 5a0c0aa..0000000
--- a/account/src/main/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
- java:/jboss/accountDs
- false
- ENABLE_SELECTIVE
-
-
-
-
-
-
-
-
diff --git a/account/src/main/resources/de/muehlencord/shared/account/business/account/boundary/ApiKeyError.properties b/account/src/main/resources/de/muehlencord/shared/account/business/account/boundary/ApiKeyError.properties
deleted file mode 100644
index 4e9b313..0000000
--- a/account/src/main/resources/de/muehlencord/shared/account/business/account/boundary/ApiKeyError.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright 2018 joern.muehlencord.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# 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.
-
-jwt_no_token=No token provided
-jwt_token_invalid=The provided token is invalid
diff --git a/account/src/main/resources/de/muehlencord/shared/account/business/account/boundary/ApiKeyError_de_DE.properties b/account/src/main/resources/de/muehlencord/shared/account/business/account/boundary/ApiKeyError_de_DE.properties
deleted file mode 100644
index 9841a53..0000000
--- a/account/src/main/resources/de/muehlencord/shared/account/business/account/boundary/ApiKeyError_de_DE.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright 2018 joern.muehlencord.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# 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.
-
-jwt_no_token=Kein Token vorhanden
-jwt_token_invalid=Das Token ist ung\u00fcltig
diff --git a/account/src/main/resources/de/muehlencord/shared/account/business/account/boundary/ApiKeyError_en_US.properties b/account/src/main/resources/de/muehlencord/shared/account/business/account/boundary/ApiKeyError_en_US.properties
deleted file mode 100644
index 4e9b313..0000000
--- a/account/src/main/resources/de/muehlencord/shared/account/business/account/boundary/ApiKeyError_en_US.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright 2018 joern.muehlencord.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# 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.
-
-jwt_no_token=No token provided
-jwt_token_invalid=The provided token is invalid
diff --git a/account/src/main/resources/de/muehlencord/shared/account/business/application/boundary/ApplicationServiceError.properties b/account/src/main/resources/de/muehlencord/shared/account/business/application/boundary/ApplicationServiceError.properties
deleted file mode 100644
index 058f521..0000000
--- a/account/src/main/resources/de/muehlencord/shared/account/business/application/boundary/ApplicationServiceError.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Copyright 2018 joern.muehlencord.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# 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.
-#
-list_denied=You are not allowed to list any application
diff --git a/account/src/main/resources/de/muehlencord/shared/account/business/application/boundary/ApplicationServiceError_de_DE.properties b/account/src/main/resources/de/muehlencord/shared/account/business/application/boundary/ApplicationServiceError_de_DE.properties
deleted file mode 100644
index 954a7db..0000000
--- a/account/src/main/resources/de/muehlencord/shared/account/business/application/boundary/ApplicationServiceError_de_DE.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Copyright 2018 joern.muehlencord.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# 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.
-#
-list_denied=Sie haben nicht die n\u00f6tige Rechte eine Applikationen aufzulisten.
diff --git a/account/src/main/resources/de/muehlencord/shared/account/business/application/boundary/ApplicationServiceError_en_US.properties b/account/src/main/resources/de/muehlencord/shared/account/business/application/boundary/ApplicationServiceError_en_US.properties
deleted file mode 100644
index d56d6e0..0000000
--- a/account/src/main/resources/de/muehlencord/shared/account/business/application/boundary/ApplicationServiceError_en_US.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Copyright 2018 joern.muehlencord.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# 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.
-#
-list_denied=User not allowed to list any application
diff --git a/account/src/test/java/de/muehlencord/shared/account/business/account/boundary/ApiKeyServiceTest.java b/account/src/test/java/de/muehlencord/shared/account/business/account/boundary/ApiKeyServiceTest.java
deleted file mode 100644
index da40019..0000000
--- a/account/src/test/java/de/muehlencord/shared/account/business/account/boundary/ApiKeyServiceTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package de.muehlencord.shared.account.business.account.boundary;
-
-import de.muehlencord.shared.account.business.account.control.AccountControl;
-import de.muehlencord.shared.account.business.account.entity.AccountEntity;
-import de.muehlencord.shared.account.business.application.entity.ApplicationRoleEntity;
-import de.muehlencord.shared.account.business.config.boundary.ConfigService;
-import de.muehlencord.shared.account.business.config.entity.ConfigException;
-import de.muehlencord.shared.account.dao.ApiKeyObject;
-import de.muehlencord.shared.db.ControllerException;
-import java.util.ArrayList;
-import javax.persistence.EntityManager;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.fail;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import static org.mockito.ArgumentMatchers.anyBoolean;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.mockito.stubbing.Answer;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Joern Muehlencord
- */
-@ExtendWith(MockitoExtension.class)
-public class ApiKeyServiceTest {
-
- private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(ApiKeyServiceTest.class);
-
- ApiKeyService apiKeyService;
-
- @BeforeEach
- public void setup() {
- apiKeyService = new ApiKeyService();
- apiKeyService.configService = mock(ConfigService.class);
- try {
- when(apiKeyService.configService.getConfigValue(anyString(), anyString(), anyBoolean())).thenReturn("120");
- when(apiKeyService.configService.getConfigValue(anyString())).thenAnswer(new Answer() {
- @Override
- public String answer(InvocationOnMock invocation) throws Throwable {
- Object[] args = invocation.getArguments();
- String configKey = args[0].toString();
- switch (configKey) {
- case "rest.password":
- return "secret";
- case "rest.issuer":
- return "ApiKeyServiceTest";
- default:
- return "unknown";
- }
- }
- });
- } catch (ConfigException | ControllerException ex) {
- LOGGER.error(ex.getMessage());
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Detailed stacktrace", new Object[]{ex});
- }
- fail("An exception occured");
- }
- apiKeyService.accountControl = mock(AccountControl.class);
- when(apiKeyService.accountControl.getAccountEntity(anyString(), anyBoolean())).thenAnswer(new Answer() {
- @Override
- public AccountEntity answer(InvocationOnMock iom) throws Throwable {
- Object[] args = iom.getArguments();
- String userName = args[0].toString();
- boolean loadRoles = (boolean) args[1];
- AccountEntity account = new AccountEntity();
- account.setUsername(userName);
- account.setFirstname("FirstName");
- account.setLastname("LastName");
- if (loadRoles) {
- account.setApplicationRoleList(new ArrayList<>());
- ApplicationRoleEntity exampleRoleEntity = new ApplicationRoleEntity();
- exampleRoleEntity.setRoleName("Example Role");
- account.getApplicationRoleList().add(exampleRoleEntity);
- }
- return account;
- }
-
- });
- apiKeyService.em = mock (EntityManager.class);
- apiKeyService.init();
- }
-
- @Test
- public void testCreateApiKey() {
- try {
- ApiKeyObject apiKeyObject = apiKeyService.createNewApiKey("web", (short) 120);
- assertNotNull(apiKeyObject);
- LOGGER.info("authToken: "+apiKeyObject.getAuthToken());
- } catch (ApiKeyException ex) {
- LOGGER.error(ex.getMessage());
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Detailed stacktrace", new Object[]{ex});
- }
-
- }
- }
-
-}
diff --git a/account/src/test/java/de/muehlencord/shared/account/business/config/boundary/ConfigServiceTest.java b/account/src/test/java/de/muehlencord/shared/account/business/config/boundary/ConfigServiceTest.java
deleted file mode 100644
index 7e4d7f1..0000000
--- a/account/src/test/java/de/muehlencord/shared/account/business/config/boundary/ConfigServiceTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.business.config.boundary;
-
-import de.muehlencord.shared.account.business.account.entity.AccountEntity;
-import de.muehlencord.shared.account.business.account.entity.AccountLoginEntity;
-import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
-import de.muehlencord.shared.account.business.config.entity.ConfigEntity;
-import de.muehlencord.shared.account.business.config.entity.ConfigEntityPK;
-import java.util.UUID;
-import javax.persistence.EntityManager;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import static org.mockito.Mockito.when;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-/**
- *
- * @author joern.muehlencord
- */
-@ExtendWith(MockitoExtension.class)
-public class ConfigServiceTest {
-
- @InjectMocks
- private ConfigService configService;
-
- @Mock
- private EntityManager entityManagerMock;
-
- @BeforeEach
- public void init() {
- ApplicationEntity application = new ApplicationEntity();
- application.setId(UUID.randomUUID());
- application.setApplicationName("Test App");
-
- AccountEntity account = new AccountEntity();
- account.setUsername("system");
- AccountLoginEntity login = new AccountLoginEntity();
- login.setAccount (account);
- account.setAccountLogin(login);
-
- ConfigEntityPK pk = new ConfigEntityPK(application, "account.maxFailedLogins", account);
- ConfigEntity configEntity = new ConfigEntity (pk);
- configEntity.setConfigValue("7");
- when (entityManagerMock.find(ConfigEntity.class, "account.maxFailedLogins")).thenReturn (configEntity);
- }
-
- @Test
- @Disabled
- // TODO move to account test
- public void testGetMaxFailedLogins() {
-// configService.init();
-// assertEquals ("maxFailedLogins", 7, configService.getMaxFailedLogins());
- }
-
-
-
-
-}
diff --git a/account/src/test/java/de/muehlencord/shared/account/shiro/realm/UserNameActiveDirectoryRealmTest.java b/account/src/test/java/de/muehlencord/shared/account/shiro/realm/UserNameActiveDirectoryRealmTest.java
deleted file mode 100644
index 4382f9a..0000000
--- a/account/src/test/java/de/muehlencord/shared/account/shiro/realm/UserNameActiveDirectoryRealmTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.shiro.realm;
-
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.authc.AuthenticationException;
-import org.apache.shiro.authc.UsernamePasswordToken;
-import org.apache.shiro.config.IniSecurityManagerFactory;
-import org.apache.shiro.mgt.SecurityManager;
-import org.apache.shiro.subject.Subject;
-import org.junit.jupiter.api.Assertions;
-import static org.junit.jupiter.api.Assumptions.assumeFalse;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-
-/**
- *
- * @author Joern Muehlencord
- */
-public class UserNameActiveDirectoryRealmTest {
-
- @Test
- public void testUsernameLogin() {
- String userName = "root";
- String password = "secret";
- testLogin(userName, password);
- }
-
- @Test
- @Disabled
- public void testEmailaddressLogin() {
- String userName = "user.name@domain.com";
- String password = "secret";
- Assertions.assertThrows(AuthenticationException.class, () -> {
- testLogin(userName, password);
- });
- }
-
- @Test
- public void testWrongUserNamePassword() {
- String userName = "test123";
- String password = "secret";
- Assertions.assertThrows(AuthenticationException.class, () -> {
- testLogin(userName, password);
- });
- }
-
- private void testLogin(String userName, String password) throws AuthenticationException {
- assumeFalse(UserNameActiveDirectoryRealmTest.class.getResource("/shiro.ini") == null);
-
- IniSecurityManagerFactory factory = new IniSecurityManagerFactory("classpath:shiro.ini");
- SecurityManager securityManager = factory.getInstance();
- SecurityUtils.setSecurityManager(securityManager);
-
- UsernamePasswordToken token = new UsernamePasswordToken(userName, password);
- Subject currentUser = SecurityUtils.getSubject();
-
- currentUser.login(token);
- System.out.println("Logged in");
- }
-
-}
diff --git a/account/src/test/java/de/muehlencord/shared/account/util/SecurityUtilTest.java b/account/src/test/java/de/muehlencord/shared/account/util/SecurityUtilTest.java
deleted file mode 100644
index 1c56601..0000000
--- a/account/src/test/java/de/muehlencord/shared/account/util/SecurityUtilTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2018 joern.muehlencord.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 de.muehlencord.shared.account.util;
-
-import org.junit.jupiter.api.Test;
-
-/**
- *
- * @author Joern Muehlencord
- */
-public class SecurityUtilTest {
-
-
- @Test
- public void testCreatePassword() {
- System.out.println (SecurityUtil.createPassword("secret"));
- }
-
-}
diff --git a/account/src/test/resources/log4j.xml b/account/src/test/resources/log4j.xml
deleted file mode 100644
index 944fa4a..0000000
--- a/account/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/account/src/test/resources/shiro.ini b/account/src/test/resources/shiro.ini
deleted file mode 100644
index 436c465..0000000
--- a/account/src/test/resources/shiro.ini
+++ /dev/null
@@ -1,25 +0,0 @@
-# =============================================================================
-# Tutorial INI configuration
-#
-# Usernames/passwords are based on the classic Mel Brooks' film "Spaceballs" :)
-# =============================================================================
-
-# -----------------------------------------------------------------------------
-# Users and their (optional) assigned roles
-# username = password, role1, role2, ..., roleN
-# -----------------------------------------------------------------------------
-[users]
-root = secret, admin
-guest = guest, guest
-presidentskroob = 12345, president
-darkhelmet = ludicrousspeed, darklord, schwartz
-lonestarr = vespa, goodguy, schwartz
-
-# -----------------------------------------------------------------------------
-# Roles with assigned permissions
-# roleName = perm1, perm2, ..., permN
-# -----------------------------------------------------------------------------
-[roles]
-admin = *
-schwartz = lightsaber:*
-goodguy = winnebago:drive:eagle5
\ No newline at end of file
diff --git a/account/src/test/resources/shiro.ini.dist b/account/src/test/resources/shiro.ini.dist
deleted file mode 100644
index f67381e..0000000
--- a/account/src/test/resources/shiro.ini.dist
+++ /dev/null
@@ -1,30 +0,0 @@
-[main]
-contextFactory = org.apache.shiro.realm.ldap.JndiLdapContextFactory
-contextFactory.url = ldaps://ldap.domain.com:636
-contextFactory.systemUsername = user.name@domain.com
-contextFactory.systemPassword = secret
-contextFactory.environment[java.naming.security.protocol] = ssl
-
-cacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager
-securityManager.cacheManager = $cacheManager
-
-# HashService
-hashService = org.apache.shiro.crypto.hash.DefaultHashService
-hashService.hashIterations = 500000
-hashService.hashAlgorithmName = SHA-512
-hashService.generatePublicSalt = true
-
-# Password service
-passwordService = org.apache.shiro.authc.credential.DefaultPasswordService
-passwordService.hashService = $hashService
-
-# LDAP Realm setup
-ldapRealm = de.muehlencord.shared.account.util.UserNameActiveDirectoryRealm
-ldapRealm.principalSuffix = @domain.com
-ldapRealm.ldapContextFactory = $contextFactory
-ldapRealm.searchBase = dc=domain,dc=com
-
-# LDAP (authentication) activation
-authcStrategy = org.apache.shiro.authc.pam.AllSuccessfulStrategy
-securityManager.realms = $ldapRealm
-securityManager.authenticator.authenticationStrategy = $authcStrategy
diff --git a/configuration/pom.xml b/configuration/pom.xml
index 89da5a1..89debae 100644
--- a/configuration/pom.xml
+++ b/configuration/pom.xml
@@ -1,3 +1,19 @@
+
+
4.0.0
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/BooleanParameter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/BooleanParameter.java
index 186b470..b161b6a 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/BooleanParameter.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/BooleanParameter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration;
import de.muehlencord.shared.configuration.converter.BooleanStringConverter;
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/Configuration.java b/configuration/src/main/java/de/muehlencord/shared/configuration/Configuration.java
index 4a71d2f..d6af2c7 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/Configuration.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/Configuration.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration;
import java.util.Map;
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/ConfigurationException.java b/configuration/src/main/java/de/muehlencord/shared/configuration/ConfigurationException.java
index 0ed7081..9b45171 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/ConfigurationException.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/ConfigurationException.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class ConfigurationException extends Exception {
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/ConverterException.java b/configuration/src/main/java/de/muehlencord/shared/configuration/ConverterException.java
index 96c91d0..01c493d 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/ConverterException.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/ConverterException.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class ConverterException extends Exception {
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/DateParameter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/DateParameter.java
index da8f132..1060463 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/DateParameter.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/DateParameter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration;
import de.muehlencord.shared.configuration.converter.DateStringConverter;
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/DefaultConfiguration.java b/configuration/src/main/java/de/muehlencord/shared/configuration/DefaultConfiguration.java
index f18f354..db47cc1 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/DefaultConfiguration.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/DefaultConfiguration.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration;
import java.util.HashMap;
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/IntegerParameter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/IntegerParameter.java
index 430517b..8f0d49a 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/IntegerParameter.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/IntegerParameter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration;
import de.muehlencord.shared.configuration.converter.IntegerStringConverter;
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/Parameter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/Parameter.java
index dc3e294..55d6edd 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/Parameter.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/Parameter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration;
import java.util.ArrayList;
@@ -10,7 +25,7 @@ import org.slf4j.LoggerFactory;
/**
*
* @param type of parameter
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public abstract class Parameter {
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/ParameterFactory.java b/configuration/src/main/java/de/muehlencord/shared/configuration/ParameterFactory.java
index 25cb003..745bc57 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/ParameterFactory.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/ParameterFactory.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration;
import java.net.URI;
@@ -5,7 +20,7 @@ import java.util.Date;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public abstract class ParameterFactory {
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/StringConverter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/StringConverter.java
index d361a31..d850910 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/StringConverter.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/StringConverter.java
@@ -1,9 +1,24 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration;
/**
*
* @param the class type of the parameter value to convert
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public interface StringConverter {
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/StringParameter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/StringParameter.java
index ae103ba..51ed781 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/StringParameter.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/StringParameter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration;
import de.muehlencord.shared.configuration.converter.StringStringConverter;
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/URIParameter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/URIParameter.java
index 5e00496..cb0dff3 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/URIParameter.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/URIParameter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration;
import de.muehlencord.shared.configuration.converter.URIStringConverter;
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/ValidationException.java b/configuration/src/main/java/de/muehlencord/shared/configuration/ValidationException.java
index 4523819..abee0fc 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/ValidationException.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/ValidationException.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration;
/**
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/Validator.java b/configuration/src/main/java/de/muehlencord/shared/configuration/Validator.java
index 44de24b..42e6a10 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/Validator.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/Validator.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration;
/**
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/converter/BooleanStringConverter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/converter/BooleanStringConverter.java
index fe8a725..cdaea5e 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/converter/BooleanStringConverter.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/converter/BooleanStringConverter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration.converter;
import de.muehlencord.shared.configuration.ConverterException;
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/converter/DateStringConverter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/converter/DateStringConverter.java
index f180327..887c276 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/converter/DateStringConverter.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/converter/DateStringConverter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration.converter;
import de.muehlencord.shared.configuration.ConverterException;
@@ -8,7 +23,7 @@ import java.util.Locale;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class DateStringConverter implements StringConverter {
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/converter/IntegerStringConverter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/converter/IntegerStringConverter.java
index ad3b367..411ba4e 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/converter/IntegerStringConverter.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/converter/IntegerStringConverter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration.converter;
import de.muehlencord.shared.configuration.ConverterException;
@@ -6,7 +21,7 @@ import static java.lang.Integer.parseInt;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class IntegerStringConverter implements StringConverter {
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/converter/StringStringConverter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/converter/StringStringConverter.java
index 8737052..94ca37d 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/converter/StringStringConverter.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/converter/StringStringConverter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration.converter;
import de.muehlencord.shared.configuration.ConverterException;
@@ -5,7 +20,7 @@ import de.muehlencord.shared.configuration.StringConverter;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class StringStringConverter implements StringConverter {
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/converter/URIStringConverter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/converter/URIStringConverter.java
index f03d774..f8efeb3 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/converter/URIStringConverter.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/converter/URIStringConverter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration.converter;
import de.muehlencord.shared.configuration.ConverterException;
@@ -7,7 +22,7 @@ import static java.net.URI.create;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class URIStringConverter implements StringConverter {
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/validator/IntgerRangeValidator.java b/configuration/src/main/java/de/muehlencord/shared/configuration/validator/IntgerRangeValidator.java
index a55331b..17c7781 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/validator/IntgerRangeValidator.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/validator/IntgerRangeValidator.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration.validator;
import de.muehlencord.shared.configuration.ValidationException;
diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/validator/StringValueListValidator.java b/configuration/src/main/java/de/muehlencord/shared/configuration/validator/StringValueListValidator.java
index 567253f..c36e81a 100644
--- a/configuration/src/main/java/de/muehlencord/shared/configuration/validator/StringValueListValidator.java
+++ b/configuration/src/main/java/de/muehlencord/shared/configuration/validator/StringValueListValidator.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.configuration.validator;
import de.muehlencord.shared.configuration.ValidationException;
diff --git a/db/pom.xml b/db/pom.xml
index 85a7903..895cc0d 100644
--- a/db/pom.xml
+++ b/db/pom.xml
@@ -1,4 +1,20 @@
+
+
4.0.0
@@ -24,16 +40,6 @@
shared-util
-
- org.junit.jupiter
- junit-jupiter-api
- test
-
-
- org.junit.jupiter
- junit-jupiter-params
- test
-
org.junit.jupiter
junit-jupiter-engine
diff --git a/db/src/main/java/de/muehlencord/shared/db/AbstractController.java b/db/src/main/java/de/muehlencord/shared/db/AbstractController.java
index 8617c7d..70962d6 100644
--- a/db/src/main/java/de/muehlencord/shared/db/AbstractController.java
+++ b/db/src/main/java/de/muehlencord/shared/db/AbstractController.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2016 Joern Muehlencord
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/db/src/main/java/de/muehlencord/shared/db/ApplicationPU.java b/db/src/main/java/de/muehlencord/shared/db/ApplicationPU.java
index 0622d28..d2cf36f 100644
--- a/db/src/main/java/de/muehlencord/shared/db/ApplicationPU.java
+++ b/db/src/main/java/de/muehlencord/shared/db/ApplicationPU.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 joern.muehlencord.
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/db/src/main/java/de/muehlencord/shared/db/ApplicationTransactionJoinInterceptor.java b/db/src/main/java/de/muehlencord/shared/db/ApplicationTransactionJoinInterceptor.java
index b2ee97f..c98f512 100644
--- a/db/src/main/java/de/muehlencord/shared/db/ApplicationTransactionJoinInterceptor.java
+++ b/db/src/main/java/de/muehlencord/shared/db/ApplicationTransactionJoinInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 joern.muehlencord.
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/db/src/main/java/de/muehlencord/shared/db/Audit.java b/db/src/main/java/de/muehlencord/shared/db/Audit.java
index 822e309..b55887a 100644
--- a/db/src/main/java/de/muehlencord/shared/db/Audit.java
+++ b/db/src/main/java/de/muehlencord/shared/db/Audit.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2019 Joern Muehlencord .
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@ import javax.validation.constraints.NotNull;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
@Embeddable
public class Audit implements Serializable {
diff --git a/db/src/main/java/de/muehlencord/shared/db/AuditListener.java b/db/src/main/java/de/muehlencord/shared/db/AuditListener.java
index 75a1583..e002c7e 100644
--- a/db/src/main/java/de/muehlencord/shared/db/AuditListener.java
+++ b/db/src/main/java/de/muehlencord/shared/db/AuditListener.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2019 joern.muehlencord.
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory;
/**
* Does not work, cannot Spring independet inject current username - implemented in AbstractController manually
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class AuditListener {
diff --git a/db/src/main/java/de/muehlencord/shared/db/Auditable.java b/db/src/main/java/de/muehlencord/shared/db/Auditable.java
index 7fda0da..f966169 100644
--- a/db/src/main/java/de/muehlencord/shared/db/Auditable.java
+++ b/db/src/main/java/de/muehlencord/shared/db/Auditable.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2019 Joern Muehlencord .
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@ package de.muehlencord.shared.db;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public interface Auditable {
diff --git a/db/src/main/java/de/muehlencord/shared/db/CommonAbstractController.java b/db/src/main/java/de/muehlencord/shared/db/CommonAbstractController.java
index 882bd5e..2250a54 100644
--- a/db/src/main/java/de/muehlencord/shared/db/CommonAbstractController.java
+++ b/db/src/main/java/de/muehlencord/shared/db/CommonAbstractController.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2019 joern.muehlencord.
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,7 +40,7 @@ import org.apache.commons.lang3.StringUtils;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public abstract class CommonAbstractController {
diff --git a/db/src/main/java/de/muehlencord/shared/db/ControllerException.java b/db/src/main/java/de/muehlencord/shared/db/ControllerException.java
index 978472a..126e57f 100644
--- a/db/src/main/java/de/muehlencord/shared/db/ControllerException.java
+++ b/db/src/main/java/de/muehlencord/shared/db/ControllerException.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2019 joern.muehlencord.
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ import javax.ejb.ApplicationException;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
@ApplicationException(rollback = true)
public class ControllerException extends Exception {
diff --git a/db/src/main/java/de/muehlencord/shared/db/EndDateable.java b/db/src/main/java/de/muehlencord/shared/db/EndDateable.java
index 5251b9f..37078b0 100644
--- a/db/src/main/java/de/muehlencord/shared/db/EndDateable.java
+++ b/db/src/main/java/de/muehlencord/shared/db/EndDateable.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2019 Joern Muehlencord .
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/db/src/main/java/de/muehlencord/shared/db/EntityUtil.java b/db/src/main/java/de/muehlencord/shared/db/EntityUtil.java
index b2cd843..f0e16e8 100644
--- a/db/src/main/java/de/muehlencord/shared/db/EntityUtil.java
+++ b/db/src/main/java/de/muehlencord/shared/db/EntityUtil.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2019 joern.muehlencord.
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class EntityUtil {
diff --git a/db/src/main/java/de/muehlencord/shared/db/IdentifiableEntity.java b/db/src/main/java/de/muehlencord/shared/db/IdentifiableEntity.java
index 2c76d40..bcec87e 100644
--- a/db/src/main/java/de/muehlencord/shared/db/IdentifiableEntity.java
+++ b/db/src/main/java/de/muehlencord/shared/db/IdentifiableEntity.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 joern.muehlencord.
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ import java.io.Serializable;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public interface IdentifiableEntity extends Serializable{
diff --git a/db/src/main/java/de/muehlencord/shared/db/StandardController.java b/db/src/main/java/de/muehlencord/shared/db/StandardController.java
index a45f404..ec48346 100644
--- a/db/src/main/java/de/muehlencord/shared/db/StandardController.java
+++ b/db/src/main/java/de/muehlencord/shared/db/StandardController.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2019 joern.muehlencord.
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@ import javax.persistence.criteria.Root;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
@Stateless
public class StandardController extends CommonAbstractController {
diff --git a/db/src/main/java/de/muehlencord/shared/db/Validity.java b/db/src/main/java/de/muehlencord/shared/db/Validity.java
index b8f5042..06903d2 100644
--- a/db/src/main/java/de/muehlencord/shared/db/Validity.java
+++ b/db/src/main/java/de/muehlencord/shared/db/Validity.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 joern.muehlencord.
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/db/src/main/resources/log4j.xml b/db/src/main/resources/log4j.xml
index 4388d5e..b9c3be9 100644
--- a/db/src/main/resources/log4j.xml
+++ b/db/src/main/resources/log4j.xml
@@ -1,4 +1,20 @@
-
+
+
+
diff --git a/db/src/test/java/de/muehlencord/shared/db/CounterEntity.java b/db/src/test/java/de/muehlencord/shared/db/CounterEntity.java
index 4729025..064e5bd 100644
--- a/db/src/test/java/de/muehlencord/shared/db/CounterEntity.java
+++ b/db/src/test/java/de/muehlencord/shared/db/CounterEntity.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.db;
import java.io.Serializable;
@@ -13,7 +28,7 @@ import javax.validation.constraints.Size;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
@Entity
@Table(name = "counter")
diff --git a/db/src/test/java/de/muehlencord/shared/db/EntityUtilTest.java b/db/src/test/java/de/muehlencord/shared/db/EntityUtilTest.java
index 5830521..3ef8643 100644
--- a/db/src/test/java/de/muehlencord/shared/db/EntityUtilTest.java
+++ b/db/src/test/java/de/muehlencord/shared/db/EntityUtilTest.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2019 joern.muehlencord.
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class EntityUtilTest {
diff --git a/db/src/test/java/de/muehlencord/shared/db/TestEntity.java b/db/src/test/java/de/muehlencord/shared/db/TestEntity.java
index 90c2dd2..a403d82 100644
--- a/db/src/test/java/de/muehlencord/shared/db/TestEntity.java
+++ b/db/src/test/java/de/muehlencord/shared/db/TestEntity.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.db;
import java.io.Serializable;
@@ -18,7 +33,7 @@ import javax.validation.constraints.Size;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
@Entity
@Table(name = "address")
diff --git a/jeeutil/pom.xml b/jeeutil/pom.xml
index 66a2bac..dab8b2b 100644
--- a/jeeutil/pom.xml
+++ b/jeeutil/pom.xml
@@ -1,6 +1,6 @@
+
4.0.0
diff --git a/network/src/main/java/de/muehlencord/shared/network/CidrTool.java b/network/src/main/java/de/muehlencord/shared/network/CidrTool.java
index 9046bb7..a67ad0f 100644
--- a/network/src/main/java/de/muehlencord/shared/network/CidrTool.java
+++ b/network/src/main/java/de/muehlencord/shared/network/CidrTool.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network;
import static java.lang.Long.valueOf;
@@ -9,7 +24,7 @@ import java.util.List;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class CidrTool {
diff --git a/network/src/main/java/de/muehlencord/shared/network/IpInformation.java b/network/src/main/java/de/muehlencord/shared/network/IpInformation.java
index 5569a3a..ebb6f03 100644
--- a/network/src/main/java/de/muehlencord/shared/network/IpInformation.java
+++ b/network/src/main/java/de/muehlencord/shared/network/IpInformation.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network;
import java.util.ArrayList;
@@ -5,7 +20,7 @@ import java.util.List;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class IpInformation {
diff --git a/network/src/main/java/de/muehlencord/shared/network/NetworkScanner.java b/network/src/main/java/de/muehlencord/shared/network/NetworkScanner.java
index 479db35..89d6690 100644
--- a/network/src/main/java/de/muehlencord/shared/network/NetworkScanner.java
+++ b/network/src/main/java/de/muehlencord/shared/network/NetworkScanner.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network;
import java.util.ArrayList;
@@ -7,7 +22,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class NetworkScanner {
diff --git a/network/src/main/java/de/muehlencord/shared/network/PortInformation.java b/network/src/main/java/de/muehlencord/shared/network/PortInformation.java
index 3787a56..0462668 100644
--- a/network/src/main/java/de/muehlencord/shared/network/PortInformation.java
+++ b/network/src/main/java/de/muehlencord/shared/network/PortInformation.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class PortInformation {
diff --git a/network/src/main/java/de/muehlencord/shared/network/PortScan.java b/network/src/main/java/de/muehlencord/shared/network/PortScan.java
index cb74c09..bea1ab9 100644
--- a/network/src/main/java/de/muehlencord/shared/network/PortScan.java
+++ b/network/src/main/java/de/muehlencord/shared/network/PortScan.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network;
import java.net.InetSocketAddress;
@@ -10,7 +25,7 @@ import org.slf4j.LoggerFactory;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public final class PortScan {
diff --git a/network/src/main/java/de/muehlencord/shared/network/PortScanner.java b/network/src/main/java/de/muehlencord/shared/network/PortScanner.java
index 06671f1..f0eab84 100644
--- a/network/src/main/java/de/muehlencord/shared/network/PortScanner.java
+++ b/network/src/main/java/de/muehlencord/shared/network/PortScanner.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network;
import static de.muehlencord.shared.network.PortScan.portIsOpen;
@@ -12,7 +27,7 @@ import org.slf4j.LoggerFactory;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class PortScanner {
diff --git a/network/src/main/java/de/muehlencord/shared/network/ftp/FTPConnection.java b/network/src/main/java/de/muehlencord/shared/network/ftp/FTPConnection.java
index a968e17..acf9415 100644
--- a/network/src/main/java/de/muehlencord/shared/network/ftp/FTPConnection.java
+++ b/network/src/main/java/de/muehlencord/shared/network/ftp/FTPConnection.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.ftp;
import com.enterprisedt.net.ftp.FTPClient;
diff --git a/network/src/main/java/de/muehlencord/shared/network/ftp/FTPConnectionException.java b/network/src/main/java/de/muehlencord/shared/network/ftp/FTPConnectionException.java
index ab75b3f..a43c708 100644
--- a/network/src/main/java/de/muehlencord/shared/network/ftp/FTPConnectionException.java
+++ b/network/src/main/java/de/muehlencord/shared/network/ftp/FTPConnectionException.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.ftp;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class FTPConnectionException extends Exception {
diff --git a/network/src/main/java/de/muehlencord/shared/network/http/HttpLayer.java b/network/src/main/java/de/muehlencord/shared/network/http/HttpLayer.java
index 65f85a0..bb8c060 100644
--- a/network/src/main/java/de/muehlencord/shared/network/http/HttpLayer.java
+++ b/network/src/main/java/de/muehlencord/shared/network/http/HttpLayer.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.http;
import java.io.BufferedReader;
diff --git a/network/src/main/java/de/muehlencord/shared/network/http/MessageNotSendException.java b/network/src/main/java/de/muehlencord/shared/network/http/MessageNotSendException.java
index 9cc6a8d..3402144 100644
--- a/network/src/main/java/de/muehlencord/shared/network/http/MessageNotSendException.java
+++ b/network/src/main/java/de/muehlencord/shared/network/http/MessageNotSendException.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.http;
/**
diff --git a/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPConnection.java b/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPConnection.java
index de8ece2..4686a8c 100644
--- a/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPConnection.java
+++ b/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPConnection.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.ldap;
import java.util.Hashtable;
diff --git a/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPContact.java b/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPContact.java
index 57fca1c..6cac681 100644
--- a/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPContact.java
+++ b/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPContact.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.ldap;
/**
diff --git a/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPException.java b/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPException.java
index f7694b6..e3a85d5 100644
--- a/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPException.java
+++ b/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPException.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.ldap;
/**
diff --git a/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPSearch.java b/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPSearch.java
index 3c76452..d08f4bf 100644
--- a/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPSearch.java
+++ b/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPSearch.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.ldap;
import de.muehlencord.shared.util.DateUtil;
@@ -45,7 +60,7 @@ public class LDAPSearch {
*
*
* @param url the url of the ldap server to connect to like ldap://ldapserver.your.domain:389
- * @param searchBase the search base to use - e.g. DC=wincor-nixdorf,DC=com
+ * @param searchBase the search base to use - e.g. DC=domain,DC=tld
* @param username the username to connect with
* @param password the password to connect with
*/
@@ -73,7 +88,7 @@ public class LDAPSearch {
* @param authentication the authentification type to use -e.g. "SIMPLE"
* @param url the url of the ldap server to connect to like ldap://ldapserver.your.domain:389
* @param securityProtocol the security protocol to use - e.g. SIMPLE
- * @param searchBase the search base to use - e.g. DC=wincor-nixdorf,DC=com
+ * @param searchBase the search base to use - e.g. DC=domain,DC=tld
* @param username the username to connect with
* @param password the password to connect with
*/
diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/DefaultMailReader.java b/network/src/main/java/de/muehlencord/shared/network/mail/DefaultMailReader.java
index 7e13f66..422233a 100644
--- a/network/src/main/java/de/muehlencord/shared/network/mail/DefaultMailReader.java
+++ b/network/src/main/java/de/muehlencord/shared/network/mail/DefaultMailReader.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.mail;
import de.muehlencord.shared.util.StringUtil;
diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/MailMessage.java b/network/src/main/java/de/muehlencord/shared/network/mail/MailMessage.java
index fb810cc..a6635d2 100644
--- a/network/src/main/java/de/muehlencord/shared/network/mail/MailMessage.java
+++ b/network/src/main/java/de/muehlencord/shared/network/mail/MailMessage.java
@@ -1,5 +1,17 @@
-/**
- * package containing containing acess to mail messages, covering javax.mail api
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.mail;
diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/MailMessageException.java b/network/src/main/java/de/muehlencord/shared/network/mail/MailMessageException.java
index f9327c0..ef7d373 100644
--- a/network/src/main/java/de/muehlencord/shared/network/mail/MailMessageException.java
+++ b/network/src/main/java/de/muehlencord/shared/network/mail/MailMessageException.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.mail;
/**
diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/MailMessageUtils.java b/network/src/main/java/de/muehlencord/shared/network/mail/MailMessageUtils.java
index c372abf..d3f6774 100644
--- a/network/src/main/java/de/muehlencord/shared/network/mail/MailMessageUtils.java
+++ b/network/src/main/java/de/muehlencord/shared/network/mail/MailMessageUtils.java
@@ -1,6 +1,17 @@
-/**
- * wrapper classes around javax.mail package written by Joern Muehlencord
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.mail;
diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/MailProtocol.java b/network/src/main/java/de/muehlencord/shared/network/mail/MailProtocol.java
index 2c5149e..152250c 100644
--- a/network/src/main/java/de/muehlencord/shared/network/mail/MailProtocol.java
+++ b/network/src/main/java/de/muehlencord/shared/network/mail/MailProtocol.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.mail;
import java.util.Map;
diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/MailReader.java b/network/src/main/java/de/muehlencord/shared/network/mail/MailReader.java
index 8073d53..98cf722 100644
--- a/network/src/main/java/de/muehlencord/shared/network/mail/MailReader.java
+++ b/network/src/main/java/de/muehlencord/shared/network/mail/MailReader.java
@@ -1,6 +1,17 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.mail;
diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfiguration.java b/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfiguration.java
index 628d79a..c23c040 100644
--- a/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfiguration.java
+++ b/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfiguration.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.mail;
/**
diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfigurationException.java b/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfigurationException.java
index 508c1c8..4440afd 100644
--- a/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfigurationException.java
+++ b/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfigurationException.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.mail;
/**
diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfigurationFactory.java b/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfigurationFactory.java
index b171bf6..07692d1 100644
--- a/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfigurationFactory.java
+++ b/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfigurationFactory.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.mail;
import de.muehlencord.shared.util.StringUtil;
diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConnectionException.java b/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConnectionException.java
index ee9c09c..22cea66 100644
--- a/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConnectionException.java
+++ b/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConnectionException.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.mail;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class MailReaderConnectionException extends Exception {
diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderException.java b/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderException.java
index df28bb4..0763c6f 100644
--- a/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderException.java
+++ b/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderException.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.mail;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class MailReaderException extends Exception {
diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/exchange/ExchangeMailReader.java b/network/src/main/java/de/muehlencord/shared/network/mail/exchange/ExchangeMailReader.java
index 228aa67..183ca41 100644
--- a/network/src/main/java/de/muehlencord/shared/network/mail/exchange/ExchangeMailReader.java
+++ b/network/src/main/java/de/muehlencord/shared/network/mail/exchange/ExchangeMailReader.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.mail.exchange;
import de.muehlencord.shared.network.mail.MailMessage;
diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/imap/ImapMailReader.java b/network/src/main/java/de/muehlencord/shared/network/mail/imap/ImapMailReader.java
index 2b10242..b495c68 100644
--- a/network/src/main/java/de/muehlencord/shared/network/mail/imap/ImapMailReader.java
+++ b/network/src/main/java/de/muehlencord/shared/network/mail/imap/ImapMailReader.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.mail.imap;
import de.muehlencord.shared.network.mail.DefaultMailReader;
diff --git a/network/src/main/java/de/muehlencord/shared/network/whois/AbstractWhoisParser.java b/network/src/main/java/de/muehlencord/shared/network/whois/AbstractWhoisParser.java
index 9e59372..6a84057 100644
--- a/network/src/main/java/de/muehlencord/shared/network/whois/AbstractWhoisParser.java
+++ b/network/src/main/java/de/muehlencord/shared/network/whois/AbstractWhoisParser.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.whois;
import java.util.Map;
@@ -5,7 +20,7 @@ import java.util.concurrent.ConcurrentHashMap;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public abstract class AbstractWhoisParser implements WhoisParser {
diff --git a/network/src/main/java/de/muehlencord/shared/network/whois/ArinWhoisParser.java b/network/src/main/java/de/muehlencord/shared/network/whois/ArinWhoisParser.java
index 2d87d58..93e31ab 100644
--- a/network/src/main/java/de/muehlencord/shared/network/whois/ArinWhoisParser.java
+++ b/network/src/main/java/de/muehlencord/shared/network/whois/ArinWhoisParser.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.whois;
import static de.muehlencord.shared.network.CidrTool.rangeToCidrList;
diff --git a/network/src/main/java/de/muehlencord/shared/network/whois/DefaultWhoisParser.java b/network/src/main/java/de/muehlencord/shared/network/whois/DefaultWhoisParser.java
index e2f1144..f7a35ae 100644
--- a/network/src/main/java/de/muehlencord/shared/network/whois/DefaultWhoisParser.java
+++ b/network/src/main/java/de/muehlencord/shared/network/whois/DefaultWhoisParser.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.whois;
import static de.muehlencord.shared.network.CidrTool.rangeToCidrList;
@@ -7,7 +22,7 @@ import org.slf4j.LoggerFactory;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class DefaultWhoisParser extends AbstractWhoisParser implements WhoisParser {
diff --git a/network/src/main/java/de/muehlencord/shared/network/whois/NetworkInformation.java b/network/src/main/java/de/muehlencord/shared/network/whois/NetworkInformation.java
index bd7fa06..86acc76 100644
--- a/network/src/main/java/de/muehlencord/shared/network/whois/NetworkInformation.java
+++ b/network/src/main/java/de/muehlencord/shared/network/whois/NetworkInformation.java
@@ -1,10 +1,25 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.whois;
import java.io.Serializable;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class NetworkInformation implements Serializable {
/** the serial version uid */
diff --git a/network/src/main/java/de/muehlencord/shared/network/whois/Whois.java b/network/src/main/java/de/muehlencord/shared/network/whois/Whois.java
index b776361..ace59ea 100644
--- a/network/src/main/java/de/muehlencord/shared/network/whois/Whois.java
+++ b/network/src/main/java/de/muehlencord/shared/network/whois/Whois.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.whois;
import java.util.ArrayList;
diff --git a/network/src/main/java/de/muehlencord/shared/network/whois/WhoisException.java b/network/src/main/java/de/muehlencord/shared/network/whois/WhoisException.java
index 45635bc..18bce28 100644
--- a/network/src/main/java/de/muehlencord/shared/network/whois/WhoisException.java
+++ b/network/src/main/java/de/muehlencord/shared/network/whois/WhoisException.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.whois;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class WhoisException extends Exception {
diff --git a/network/src/main/java/de/muehlencord/shared/network/whois/WhoisInformation.java b/network/src/main/java/de/muehlencord/shared/network/whois/WhoisInformation.java
index 763c051..df249e2 100644
--- a/network/src/main/java/de/muehlencord/shared/network/whois/WhoisInformation.java
+++ b/network/src/main/java/de/muehlencord/shared/network/whois/WhoisInformation.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.whois;
import java.util.ArrayList;
diff --git a/network/src/main/java/de/muehlencord/shared/network/whois/WhoisParser.java b/network/src/main/java/de/muehlencord/shared/network/whois/WhoisParser.java
index da1988d..4378930 100644
--- a/network/src/main/java/de/muehlencord/shared/network/whois/WhoisParser.java
+++ b/network/src/main/java/de/muehlencord/shared/network/whois/WhoisParser.java
@@ -1,12 +1,23 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.whois;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public interface WhoisParser {
diff --git a/network/src/main/resources/buildInfo.properties b/network/src/main/resources/buildInfo.properties
index 37404b0..77323d7 100644
--- a/network/src/main/resources/buildInfo.properties
+++ b/network/src/main/resources/buildInfo.properties
@@ -1,2 +1,17 @@
+#
+# Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
build.version=${project.version}
build.timestamp=${timestamp}
\ No newline at end of file
diff --git a/network/src/test/java/de/muehlencord/shared/network/BaseTest.java b/network/src/test/java/de/muehlencord/shared/network/BaseTest.java
index 03bc2db..d59b9e1 100644
--- a/network/src/test/java/de/muehlencord/shared/network/BaseTest.java
+++ b/network/src/test/java/de/muehlencord/shared/network/BaseTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network;
import java.io.BufferedInputStream;
diff --git a/network/src/test/java/de/muehlencord/shared/network/CidrToolTest.java b/network/src/test/java/de/muehlencord/shared/network/CidrToolTest.java
index 42baaff..0d255fb 100644
--- a/network/src/test/java/de/muehlencord/shared/network/CidrToolTest.java
+++ b/network/src/test/java/de/muehlencord/shared/network/CidrToolTest.java
@@ -1,6 +1,17 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network;
@@ -10,7 +21,7 @@ import org.junit.jupiter.api.Test;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class CidrToolTest {
diff --git a/network/src/test/java/de/muehlencord/shared/network/NetworkScannerTest.java b/network/src/test/java/de/muehlencord/shared/network/NetworkScannerTest.java
index c476ab3..2c54134 100644
--- a/network/src/test/java/de/muehlencord/shared/network/NetworkScannerTest.java
+++ b/network/src/test/java/de/muehlencord/shared/network/NetworkScannerTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network;
import java.net.InetAddress;
@@ -9,7 +24,7 @@ import org.junit.jupiter.api.Test;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class NetworkScannerTest {
diff --git a/network/src/test/java/de/muehlencord/shared/network/PortScannerTest.java b/network/src/test/java/de/muehlencord/shared/network/PortScannerTest.java
index eff3d86..dc7ba2c 100644
--- a/network/src/test/java/de/muehlencord/shared/network/PortScannerTest.java
+++ b/network/src/test/java/de/muehlencord/shared/network/PortScannerTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network;
import java.util.List;
@@ -6,7 +21,7 @@ import org.junit.jupiter.api.Test;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class PortScannerTest {
diff --git a/network/src/test/java/de/muehlencord/shared/network/RangeToCidrTest.java b/network/src/test/java/de/muehlencord/shared/network/RangeToCidrTest.java
index 1c6f4a9..b6ede1e 100644
--- a/network/src/test/java/de/muehlencord/shared/network/RangeToCidrTest.java
+++ b/network/src/test/java/de/muehlencord/shared/network/RangeToCidrTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network;
import static de.muehlencord.shared.network.CidrTool.rangeToCidrList;
@@ -5,7 +20,7 @@ import org.junit.jupiter.api.Test;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class RangeToCidrTest extends BaseTest {
diff --git a/network/src/test/java/de/muehlencord/shared/network/ftp/FTPConnectionTest.java b/network/src/test/java/de/muehlencord/shared/network/ftp/FTPConnectionTest.java
index 105d439..18914c6 100644
--- a/network/src/test/java/de/muehlencord/shared/network/ftp/FTPConnectionTest.java
+++ b/network/src/test/java/de/muehlencord/shared/network/ftp/FTPConnectionTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.ftp;
import java.io.File;
@@ -17,7 +32,7 @@ import org.slf4j.LoggerFactory;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class FTPConnectionTest {
diff --git a/network/src/test/java/de/muehlencord/shared/network/http/HttpLayerTest.java b/network/src/test/java/de/muehlencord/shared/network/http/HttpLayerTest.java
index b869893..a1b4c36 100644
--- a/network/src/test/java/de/muehlencord/shared/network/http/HttpLayerTest.java
+++ b/network/src/test/java/de/muehlencord/shared/network/http/HttpLayerTest.java
@@ -1,6 +1,17 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.http;
@@ -15,7 +26,7 @@ import org.junit.jupiter.api.Test;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class HttpLayerTest extends BaseTest {
diff --git a/network/src/test/java/de/muehlencord/shared/network/mail/MailMessageUtilsTest.java b/network/src/test/java/de/muehlencord/shared/network/mail/MailMessageUtilsTest.java
index c894f7c..1388b01 100644
--- a/network/src/test/java/de/muehlencord/shared/network/mail/MailMessageUtilsTest.java
+++ b/network/src/test/java/de/muehlencord/shared/network/mail/MailMessageUtilsTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.mail;
import de.muehlencord.shared.network.BaseTest;
diff --git a/network/src/test/java/de/muehlencord/shared/network/mail/TestSendMail.java b/network/src/test/java/de/muehlencord/shared/network/mail/TestSendMail.java
index c6ecca2..fc2e0f8 100644
--- a/network/src/test/java/de/muehlencord/shared/network/mail/TestSendMail.java
+++ b/network/src/test/java/de/muehlencord/shared/network/mail/TestSendMail.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.mail;
import java.io.File;
diff --git a/network/src/test/java/de/muehlencord/shared/network/mail/exchange/ExchangeMailReaderTest.java b/network/src/test/java/de/muehlencord/shared/network/mail/exchange/ExchangeMailReaderTest.java
index de7de55..e8502ca 100644
--- a/network/src/test/java/de/muehlencord/shared/network/mail/exchange/ExchangeMailReaderTest.java
+++ b/network/src/test/java/de/muehlencord/shared/network/mail/exchange/ExchangeMailReaderTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.mail.exchange;
import de.muehlencord.shared.network.mail.MailMessage;
diff --git a/network/src/test/java/de/muehlencord/shared/network/mail/imap/ImapMailReaderTest.java b/network/src/test/java/de/muehlencord/shared/network/mail/imap/ImapMailReaderTest.java
index de365a3..45e4b5e 100644
--- a/network/src/test/java/de/muehlencord/shared/network/mail/imap/ImapMailReaderTest.java
+++ b/network/src/test/java/de/muehlencord/shared/network/mail/imap/ImapMailReaderTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.mail.imap;
import de.muehlencord.shared.network.BaseTest;
@@ -13,7 +28,7 @@ import org.junit.jupiter.api.Test;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class ImapMailReaderTest extends BaseTest {
diff --git a/network/src/test/java/de/muehlencord/shared/network/whois/ArinWhoisParserTest.java b/network/src/test/java/de/muehlencord/shared/network/whois/ArinWhoisParserTest.java
index 4a096d5..223e6d2 100644
--- a/network/src/test/java/de/muehlencord/shared/network/whois/ArinWhoisParserTest.java
+++ b/network/src/test/java/de/muehlencord/shared/network/whois/ArinWhoisParserTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.whois;
import de.muehlencord.shared.network.BaseTest;
@@ -8,7 +23,7 @@ import org.junit.jupiter.api.Test;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class ArinWhoisParserTest extends BaseTest {
diff --git a/network/src/test/java/de/muehlencord/shared/network/whois/WhoisTest.java b/network/src/test/java/de/muehlencord/shared/network/whois/WhoisTest.java
index 6f1aaac..fc9a159 100644
--- a/network/src/test/java/de/muehlencord/shared/network/whois/WhoisTest.java
+++ b/network/src/test/java/de/muehlencord/shared/network/whois/WhoisTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.network.whois;
import de.muehlencord.shared.network.BaseTest;
@@ -10,7 +25,7 @@ import org.junit.jupiter.api.Test;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class WhoisTest extends BaseTest {
diff --git a/network/src/test/resources/log4j.xml b/network/src/test/resources/log4j.xml
index ef9e1bb..e8de847 100644
--- a/network/src/test/resources/log4j.xml
+++ b/network/src/test/resources/log4j.xml
@@ -1,4 +1,20 @@
-
+
+
+
@@ -9,7 +25,7 @@
-
+
diff --git a/network/src/test/resources/test.properties b/network/src/test/resources/test.properties
index 4e0137b..021693b 100644
--- a/network/src/test/resources/test.properties
+++ b/network/src/test/resources/test.properties
@@ -1,4 +1,18 @@
-## connection to smtp server
+#
+# Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
smtp.server=meta.muehlencord.intra
## connection to imap server
diff --git a/network/src/test/resources/testprod.properties b/network/src/test/resources/testprod.properties
index dd79431..ce89f83 100644
--- a/network/src/test/resources/testprod.properties
+++ b/network/src/test/resources/testprod.properties
@@ -1,4 +1,18 @@
-## connection to smtp server
+#
+# Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
smtp.server=meta.muehlencord.intra
## connection to imap server
diff --git a/pdf/pom.xml b/pdf/pom.xml
index cfb6add..16dc5e2 100644
--- a/pdf/pom.xml
+++ b/pdf/pom.xml
@@ -1,4 +1,20 @@
+
+
4.0.0
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/CellValue.java b/pdf/src/main/java/de/muehlencord/shared/pdf/CellValue.java
index 729eff9..c638d8f 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/CellValue.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/CellValue.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
abstract class CellValue {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/ColumnDefinition.java b/pdf/src/main/java/de/muehlencord/shared/pdf/ColumnDefinition.java
index 91e5d02..5dbce13 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/ColumnDefinition.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/ColumnDefinition.java
@@ -1,10 +1,25 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.annotations.Expose;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
class ColumnDefinition {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/ConfigurationException.java b/pdf/src/main/java/de/muehlencord/shared/pdf/ConfigurationException.java
index 7737e8b..3171cb3 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/ConfigurationException.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/ConfigurationException.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class ConfigurationException extends Exception {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/Content.java b/pdf/src/main/java/de/muehlencord/shared/pdf/Content.java
index c434a94..3d3db35 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/Content.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/Content.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.annotations.Expose;
@@ -7,7 +22,7 @@ import org.apache.pdfbox.pdmodel.common.PDRectangle;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
abstract class Content implements TemplateSerializeable {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/Coordinate.java b/pdf/src/main/java/de/muehlencord/shared/pdf/Coordinate.java
index 5c79843..aa90cbf 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/Coordinate.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/Coordinate.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
class Coordinate {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/DefaultTableRow.java b/pdf/src/main/java/de/muehlencord/shared/pdf/DefaultTableRow.java
index 2fc8337..2415195 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/DefaultTableRow.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/DefaultTableRow.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.annotations.Expose;
@@ -6,7 +21,7 @@ import java.util.List;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
class DefaultTableRow extends TableRow implements TemplateSerializeable {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/DefaultTableRowTypeAdapterFactory.java b/pdf/src/main/java/de/muehlencord/shared/pdf/DefaultTableRowTypeAdapterFactory.java
index 64346c3..92f5bc8 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/DefaultTableRowTypeAdapterFactory.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/DefaultTableRowTypeAdapterFactory.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.JsonElement;
@@ -5,7 +20,7 @@ import com.google.gson.JsonObject;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
class DefaultTableRowTypeAdapterFactory extends GsonCustomizedTypeAdapterFactory {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/GsonCustomizedTypeAdapterFactory.java b/pdf/src/main/java/de/muehlencord/shared/pdf/GsonCustomizedTypeAdapterFactory.java
index 45316b0..16ecb10 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/GsonCustomizedTypeAdapterFactory.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/GsonCustomizedTypeAdapterFactory.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.Gson;
@@ -11,7 +26,7 @@ import java.io.IOException;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
abstract class GsonCustomizedTypeAdapterFactory implements TypeAdapterFactory {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/GsonUtil.java b/pdf/src/main/java/de/muehlencord/shared/pdf/GsonUtil.java
index 02622c9..1421337 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/GsonUtil.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/GsonUtil.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.Gson;
@@ -5,7 +20,7 @@ import com.google.gson.GsonBuilder;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
class GsonUtil {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/InterfaceAdapter.java b/pdf/src/main/java/de/muehlencord/shared/pdf/InterfaceAdapter.java
index 14a45a1..018cc6d 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/InterfaceAdapter.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/InterfaceAdapter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.JsonDeserializationContext;
@@ -11,7 +26,7 @@ import java.lang.reflect.Type;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
class InterfaceAdapter implements JsonSerializer, JsonDeserializer {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFDocument.java b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFDocument.java
index 545b99a..d489c5c 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFDocument.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFDocument.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.annotations.Expose;
@@ -13,7 +28,7 @@ import org.apache.pdfbox.pdmodel.font.PDType1Font;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class PDFDocument {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFFont.java b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFFont.java
index 2ae1a81..3abf1cf 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFFont.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFFont.java
@@ -1,10 +1,25 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.annotations.Expose;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class PDFFont implements TemplateSerializeable {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFImageContent.java b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFImageContent.java
index 0ef22b1..695b4cd 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFImageContent.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFImageContent.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.annotations.Expose;
@@ -12,7 +27,7 @@ import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class PDFImageContent extends Content implements TemplateSerializeable {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFImageContentTypeAdapterFactory.java b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFImageContentTypeAdapterFactory.java
index 3acb8f2..0798c56 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFImageContentTypeAdapterFactory.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFImageContentTypeAdapterFactory.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.JsonElement;
@@ -5,7 +20,7 @@ import com.google.gson.JsonObject;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
class PDFImageContentTypeAdapterFactory extends GsonCustomizedTypeAdapterFactory {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFPaperSize.java b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFPaperSize.java
index 5120f88..def4ac2 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFPaperSize.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFPaperSize.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public enum PDFPaperSize implements TemplateSerializeable {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTableContent.java b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTableContent.java
index 12f3563..2add8e0 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTableContent.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTableContent.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.Gson;
@@ -14,7 +29,7 @@ import org.slf4j.LoggerFactory;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class PDFTableContent extends Content {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTableContentTypeAdapterFactory.java b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTableContentTypeAdapterFactory.java
index 52abcec..a00e9f0 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTableContentTypeAdapterFactory.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTableContentTypeAdapterFactory.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.JsonElement;
@@ -5,7 +20,7 @@ import com.google.gson.JsonObject;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
class PDFTableContentTypeAdapterFactory extends GsonCustomizedTypeAdapterFactory {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTemplate.java b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTemplate.java
index 8e1738d..26f95a3 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTemplate.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTemplate.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.Gson;
@@ -17,7 +32,7 @@ import org.slf4j.LoggerFactory;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class PDFTemplate {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTextAlignment.java b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTextAlignment.java
index 1d82829..1c71f7c 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTextAlignment.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTextAlignment.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public enum PDFTextAlignment {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTextContent.java b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTextContent.java
index ec05cdf..1172878 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTextContent.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTextContent.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.annotations.Expose;
@@ -9,7 +24,7 @@ import org.apache.pdfbox.pdmodel.font.PDFont;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class PDFTextContent extends Content {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTextContentTypeAdapterFactory.java b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTextContentTypeAdapterFactory.java
index fbada4b..99ef78b 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTextContentTypeAdapterFactory.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/PDFTextContentTypeAdapterFactory.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.JsonElement;
@@ -5,7 +20,7 @@ import com.google.gson.JsonObject;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
class PDFTextContentTypeAdapterFactory extends GsonCustomizedTypeAdapterFactory {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/TableRow.java b/pdf/src/main/java/de/muehlencord/shared/pdf/TableRow.java
index 3e471a1..4454232 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/TableRow.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/TableRow.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
abstract class TableRow implements TemplateSerializeable {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/TemplateException.java b/pdf/src/main/java/de/muehlencord/shared/pdf/TemplateException.java
index a8ed99e..52c6bbb 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/TemplateException.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/TemplateException.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class TemplateException extends Exception {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/TemplateSerializeable.java b/pdf/src/main/java/de/muehlencord/shared/pdf/TemplateSerializeable.java
index b3a4729..0f729ee 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/TemplateSerializeable.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/TemplateSerializeable.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
interface TemplateSerializeable {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/TextCellValue.java b/pdf/src/main/java/de/muehlencord/shared/pdf/TextCellValue.java
index 4239bdb..7bbabdd 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/TextCellValue.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/TextCellValue.java
@@ -1,10 +1,25 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.annotations.Expose;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
class TextCellValue extends CellValue {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/TextCellValueTypeAdapterFactory.java b/pdf/src/main/java/de/muehlencord/shared/pdf/TextCellValueTypeAdapterFactory.java
index 5736c99..cc7512b 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/TextCellValueTypeAdapterFactory.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/TextCellValueTypeAdapterFactory.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.JsonElement;
@@ -5,7 +20,7 @@ import com.google.gson.JsonObject;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
class TextCellValueTypeAdapterFactory extends GsonCustomizedTypeAdapterFactory {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/TextElement.java b/pdf/src/main/java/de/muehlencord/shared/pdf/TextElement.java
index f609512..ab7572b 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/TextElement.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/TextElement.java
@@ -1,10 +1,25 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.annotations.Expose;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
class TextElement {
diff --git a/pdf/src/main/java/de/muehlencord/shared/pdf/util/ImageUtil.java b/pdf/src/main/java/de/muehlencord/shared/pdf/util/ImageUtil.java
index 317b7aa..52aaedb 100644
--- a/pdf/src/main/java/de/muehlencord/shared/pdf/util/ImageUtil.java
+++ b/pdf/src/main/java/de/muehlencord/shared/pdf/util/ImageUtil.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf.util;
import java.awt.image.BufferedImage;
@@ -10,7 +25,7 @@ import javax.imageio.ImageIO;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class ImageUtil {
diff --git a/pdf/src/test/java/de/muehlencord/shared/pdf/DefaultTableRowTest.java b/pdf/src/test/java/de/muehlencord/shared/pdf/DefaultTableRowTest.java
index 6688de3..c5468b1 100644
--- a/pdf/src/test/java/de/muehlencord/shared/pdf/DefaultTableRowTest.java
+++ b/pdf/src/test/java/de/muehlencord/shared/pdf/DefaultTableRowTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -6,7 +21,7 @@ import org.junit.jupiter.api.Test;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class DefaultTableRowTest {
diff --git a/pdf/src/test/java/de/muehlencord/shared/pdf/Invoice.java b/pdf/src/test/java/de/muehlencord/shared/pdf/Invoice.java
index bec371b..a344d31 100644
--- a/pdf/src/test/java/de/muehlencord/shared/pdf/Invoice.java
+++ b/pdf/src/test/java/de/muehlencord/shared/pdf/Invoice.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import java.util.ArrayList;
@@ -6,7 +21,7 @@ import java.util.List;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class Invoice {
diff --git a/pdf/src/test/java/de/muehlencord/shared/pdf/InvoiceLine.java b/pdf/src/test/java/de/muehlencord/shared/pdf/InvoiceLine.java
index dc38532..6bc28f8 100644
--- a/pdf/src/test/java/de/muehlencord/shared/pdf/InvoiceLine.java
+++ b/pdf/src/test/java/de/muehlencord/shared/pdf/InvoiceLine.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class InvoiceLine {
diff --git a/pdf/src/test/java/de/muehlencord/shared/pdf/PDFFontTest.java b/pdf/src/test/java/de/muehlencord/shared/pdf/PDFFontTest.java
index e692808..b9378c6 100644
--- a/pdf/src/test/java/de/muehlencord/shared/pdf/PDFFontTest.java
+++ b/pdf/src/test/java/de/muehlencord/shared/pdf/PDFFontTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -5,7 +20,7 @@ import org.junit.jupiter.api.Test;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class PDFFontTest {
diff --git a/pdf/src/test/java/de/muehlencord/shared/pdf/PDFImageContentTest.java b/pdf/src/test/java/de/muehlencord/shared/pdf/PDFImageContentTest.java
index 7177fbe..214f6ed 100644
--- a/pdf/src/test/java/de/muehlencord/shared/pdf/PDFImageContentTest.java
+++ b/pdf/src/test/java/de/muehlencord/shared/pdf/PDFImageContentTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import java.io.File;
@@ -8,7 +23,7 @@ import org.junit.jupiter.api.Test;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class PDFImageContentTest {
diff --git a/pdf/src/test/java/de/muehlencord/shared/pdf/PDFTextContentTest.java b/pdf/src/test/java/de/muehlencord/shared/pdf/PDFTextContentTest.java
index 3cb5feb..c61d9d5 100644
--- a/pdf/src/test/java/de/muehlencord/shared/pdf/PDFTextContentTest.java
+++ b/pdf/src/test/java/de/muehlencord/shared/pdf/PDFTextContentTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import com.google.gson.Gson;
@@ -6,7 +21,7 @@ import org.junit.jupiter.api.Test;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class PDFTextContentTest {
diff --git a/pdf/src/test/java/de/muehlencord/shared/pdf/TextTest.java b/pdf/src/test/java/de/muehlencord/shared/pdf/TextTest.java
index 8663e5c..11f3916 100644
--- a/pdf/src/test/java/de/muehlencord/shared/pdf/TextTest.java
+++ b/pdf/src/test/java/de/muehlencord/shared/pdf/TextTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -6,7 +21,7 @@ import org.junit.jupiter.api.Test;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class TextTest {
diff --git a/pdf/src/test/java/de/muehlencord/shared/pdf/test/GsonSerialisation.java b/pdf/src/test/java/de/muehlencord/shared/pdf/test/GsonSerialisation.java
index 0610aa4..b554986 100644
--- a/pdf/src/test/java/de/muehlencord/shared/pdf/test/GsonSerialisation.java
+++ b/pdf/src/test/java/de/muehlencord/shared/pdf/test/GsonSerialisation.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf.test;
import de.muehlencord.shared.pdf.ConfigurationException;
@@ -18,7 +33,7 @@ import org.junit.jupiter.api.Test;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class GsonSerialisation {
diff --git a/pdf/src/test/java/de/muehlencord/shared/pdf/test/PDFDocumentTest.java b/pdf/src/test/java/de/muehlencord/shared/pdf/test/PDFDocumentTest.java
index 807b910..fafe603 100644
--- a/pdf/src/test/java/de/muehlencord/shared/pdf/test/PDFDocumentTest.java
+++ b/pdf/src/test/java/de/muehlencord/shared/pdf/test/PDFDocumentTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf.test;
import de.muehlencord.shared.pdf.ConfigurationException;
@@ -31,7 +46,7 @@ import org.junit.jupiter.api.TestMethodOrder;
/**
*
- * @author jomu
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
@TestMethodOrder(OrderAnnotation.class)
public class PDFDocumentTest {
diff --git a/pdf/src/test/java/de/muehlencord/shared/pdf/test/User.java b/pdf/src/test/java/de/muehlencord/shared/pdf/test/User.java
index 740e689..47e6e72 100644
--- a/pdf/src/test/java/de/muehlencord/shared/pdf/test/User.java
+++ b/pdf/src/test/java/de/muehlencord/shared/pdf/test/User.java
@@ -1,10 +1,25 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf.test;
import com.google.gson.annotations.Expose;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class User {
diff --git a/pdf/src/test/java/de/muehlencord/shared/pdf/util/ImageUtilTest.java b/pdf/src/test/java/de/muehlencord/shared/pdf/util/ImageUtilTest.java
index c6fe41e..f1a85d0 100644
--- a/pdf/src/test/java/de/muehlencord/shared/pdf/util/ImageUtilTest.java
+++ b/pdf/src/test/java/de/muehlencord/shared/pdf/util/ImageUtilTest.java
@@ -1,4 +1,18 @@
-
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shared.pdf.util;
import java.awt.image.BufferedImage;
@@ -10,7 +24,7 @@ import org.junit.jupiter.api.Test;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class ImageUtilTest {
diff --git a/pdf/src/test/resources/log4j.xml b/pdf/src/test/resources/log4j.xml
index 887d158..36d9a36 100644
--- a/pdf/src/test/resources/log4j.xml
+++ b/pdf/src/test/resources/log4j.xml
@@ -1,4 +1,20 @@
+
+
diff --git a/poi-util/pom.xml b/poi-util/pom.xml
index 2abf5b0..0caa566 100644
--- a/poi-util/pom.xml
+++ b/poi-util/pom.xml
@@ -1,4 +1,20 @@
+
+
4.0.0
diff --git a/poi-util/src/main/java/de/muehlencord/shared/poi/PoiException.java b/poi-util/src/main/java/de/muehlencord/shared/poi/PoiException.java
index d81e532..ce3a0e0 100644
--- a/poi-util/src/main/java/de/muehlencord/shared/poi/PoiException.java
+++ b/poi-util/src/main/java/de/muehlencord/shared/poi/PoiException.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2019 joern.muehlencord.
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@ package de.muehlencord.shared.poi;
/**
*
- * @author joern.muehlencord
+ * @author Joern Muehlencord (joern@muehlencord.de)
*/
public class PoiException extends Exception {
diff --git a/poi-util/src/main/java/de/muehlencord/shared/poi/PoiUtil.java b/poi-util/src/main/java/de/muehlencord/shared/poi/PoiUtil.java
index cfe42a2..a81a436 100644
--- a/poi-util/src/main/java/de/muehlencord/shared/poi/PoiUtil.java
+++ b/poi-util/src/main/java/de/muehlencord/shared/poi/PoiUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 Joern Muehlencord (joern (at) muehlencord.de)
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/poi-util/src/main/java/de/muehlencord/shared/poi/WorkbookApp.java b/poi-util/src/main/java/de/muehlencord/shared/poi/WorkbookApp.java
index dc3fd93..25026cf 100644
--- a/poi-util/src/main/java/de/muehlencord/shared/poi/WorkbookApp.java
+++ b/poi-util/src/main/java/de/muehlencord/shared/poi/WorkbookApp.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 Joern Muehlencord (joern (at) muehlencord.de)
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pom.xml b/pom.xml
index 404e1ea..a2a4445 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,4 +1,20 @@
+
+
4.0.0
de.muehlencord
@@ -9,11 +25,8 @@
configuration
network
- security
-
util
jeeutil
- account
pdf
shiro-faces
poi-util
@@ -96,17 +109,17 @@
org.slf4j
slf4j-api
- 1.7.26
+ 1.7.28
org.slf4j
slf4j-log4j12
- 1.7.26
+ 1.7.28
org.slf4j
jcl-over-slf4j
- 1.7.26
+ 1.7.28
@@ -161,7 +174,7 @@
com.enterprisedt
edtFTPj
- 1.5.3
+ 1.5.3
@@ -172,7 +185,7 @@
org.bouncycastle
bcprov-jdk15on
- 1.59
+ 1.62
@@ -190,7 +203,7 @@
org.freemarker
freemarker
- 2.3.28
+ 2.3.29
org.primefaces
@@ -227,28 +240,16 @@
com.inversoft
prime-jwt
- 1.3.1
+ 2.0.0
-
- org.junit.jupiter
- junit-jupiter-api
- 5.5.1
- test
-
-
- org.junit.jupiter
- junit-jupiter-params
- 5.5.1
- test
-
org.junit.jupiter
junit-jupiter-engine
5.5.1
test
-
+
org.mockito
mockito-core
diff --git a/security/pom.xml b/security/pom.xml
deleted file mode 100644
index acd596c..0000000
--- a/security/pom.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
- 4.0.0
-
- de.muehlencord.shared
- shared-security
- 1.2-SNAPSHOT
- jar
- shared-security
-
-
- shared
- de.muehlencord
- 1.2-SNAPSHOT
-
-
- http://maven.apache.org
-
-
- UTF-8
-
-
-
-
- org.junit.jupiter
- junit-jupiter-engine
- test
-
-
- commons-codec
- commons-codec
- jar
-
-
- org.slf4j
- slf4j-api
-
-
- org.bouncycastle
- bcprov-jdk15on
-
-
- com.lambdaworks
- scrypt
-
-
-
diff --git a/security/src/main/java/de/muehlencord/shared/security/Luhn.java b/security/src/main/java/de/muehlencord/shared/security/Luhn.java
deleted file mode 100644
index d79877c..0000000
--- a/security/src/main/java/de/muehlencord/shared/security/Luhn.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * File: $$RCSfile$$
- *
- * Copyright (c) 2011 by Wincor Nixdorf,
- * Heinz-Nixdorf-Ring 1, 33106 Paderborn, Germany
- *
- * This software is the confidential and proprietary information
- * of Wincor Nixdorf.
- *
- * You shall not disclose such confidential information and shall
- * use it only in accordance with the terms of the license agreement
- * you entered into with Wincor Nixdorf.
- */
-package de.muehlencord.shared.security;
-
-import static java.lang.Integer.parseInt;
-import static java.lang.String.valueOf;
-
-/**
- *
- * @author joern.muehlencord
- */
-public class Luhn {
-
- public static boolean validateNumber(final String numberStr) {
- return (computeCheckDigit(numberStr, true) == 0);
- }
-
- public static int computeCheckDigit(final String numberStr, final boolean isCheckDigitAttached) {
- boolean doubleNextDigit = !isCheckDigitAttached;
- int sum = 0;
-
- // iterate from right digit to left
- for (int currentDigitPos = numberStr.length() - 1; currentDigitPos >= 0; currentDigitPos--) {
- int currentDigit = parseInt(valueOf(numberStr.charAt(currentDigitPos)));
- if (doubleNextDigit) {
- currentDigit = currentDigit * 2;
- }
- sum += singleDigitSum(currentDigit);
- doubleNextDigit = !doubleNextDigit;
- }
-
- if ((sum % 10) > 0) {
- return (10 - (sum % 10));
- } else {
- return 0;
- }
- }
-
- private static int singleDigitSum(final int value) {
- if (value < 10) {
- return value;
- } else {
- return singleDigitSum((value / 10) + (value % 10));
- }
- }
-}
-
-/**
- * History:
- *
- * $$Log$$
- *
- */
diff --git a/security/src/main/java/de/muehlencord/shared/security/OldPasswordUtil.java b/security/src/main/java/de/muehlencord/shared/security/OldPasswordUtil.java
deleted file mode 100644
index 7625817..0000000
--- a/security/src/main/java/de/muehlencord/shared/security/OldPasswordUtil.java
+++ /dev/null
@@ -1,239 +0,0 @@
-package de.muehlencord.shared.security;
-
-import static com.lambdaworks.crypto.SCryptUtil.check;
-import static com.lambdaworks.crypto.SCryptUtil.scrypt;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
-import java.util.Arrays;
-import org.apache.commons.codec.binary.Base64;
-/**
- *
- * @author joern@muehlencord.de
- * @Deprecated uses old algorithms, do not use this class anylonger
- */
-@Deprecated
-public abstract class OldPasswordUtil {
-
- /** logging object */
- // private final static Logger LOGGER = Logger.getLogger(PasswordUtil.class);
-
- /** SCrypt CPU cost parameter */
- private final static int scryptCpuCostParameter = 16384;
- /** SCrypt memory cost parameter */
- private final static int scryptMemCostParameter = 8;
- /** SCrypt paralelization parameter */
- private final static int scryptParallelizationParameter = 1;
-
-
- /**
- * returns password (pos 0) and the salt (pos 1) of given plaintext password. Both strings are base64 encoded
- *
- * @param plainTextPassword he
- * @param saltLength the length of the salt to use
- * @return the password (pos 0) and the salt (pos 1) of given plaintext password. Both strings are base64 encoded
- *
- * @throws de.muehlencord.shared.security.SecurityException if any error occurs during the password generation
- */
- public static String[] getMD5Password(final String plainTextPassword, final int saltLength) throws SecurityException {
- byte[] unHashedPassword = getBase64MD5HashedPassword(plainTextPassword);
- byte[] salt = createSalt(saltLength);
- byte[] hashedPassword = hashPasswordWithSalt(unHashedPassword, salt);
-
- // test
- String saltStr = base64Encode(salt);
- byte[] salt2 = base64Decode(saltStr);
- if (!Arrays.equals(salt, salt2)) {
- throw new SecurityException("Salt conversion failed");
- }
-
-
- String[] returnValue = new String[2];
- returnValue[0] = base64Encode(hashedPassword);
- returnValue[1] = base64Encode(salt);
-
- return returnValue;
- }
-
- /**
- * Checks if the given password (plain text) matches the given crypted password. The crypted password is hashed with the given salt. Both strings, crypted
- * password and salt, have to be base64 encoded
- *
- * @param plainTextPassword the plaintext password to compare to
- * @param cryptedPasswordStr the crypted password to compare to
- * @param saltStr the salt needed to hash the plaintext password with to get the correct crypted password if both passwords match
- * @return true, if and only if the encryption of plainTextPassword (hashed with saltStr) equals to cryptedPasswordStr
- *
- * @throws de.muehlencord.shared.security.SecurityException if any error occures during the check
- */
- public static boolean checkPassword(String plainTextPassword, String cryptedPasswordStr, String saltStr) throws SecurityException {
- byte[] salt = base64Decode(saltStr);
- byte[] newPassword = getBase64MD5HashedPassword(plainTextPassword);
- byte[] newHashedPassword = hashPasswordWithSalt(newPassword, salt);
- byte[] crytepdPassword = base64Decode(cryptedPasswordStr);
- return Arrays.equals(crytepdPassword, newHashedPassword);
- }
-
- /**
- * returns a new salt as a string
- *
- * @param saltLength the length of the salt
- * @return a new salt as a string (base64 encoded)
- *
- * @throws SecurityException if the creation of the salt fails
- */
- public static String createSaltString(int saltLength) throws SecurityException {
- byte[] saltByteArray = createSalt(saltLength);
- String saltString = base64Encode(saltByteArray);
- if (saltString.length() > saltLength) {
- return saltString.substring(0, saltLength);
- } else {
- return saltString;
- }
- }
-
- /** returns a random string with total length starting with prefix string
- *
- * @param prefix the prefix to start the string with
- * @param length the maximum length of the string (including prefix)
- * @return a random string
- *
- * @throws SecurityException if the random string could not be computed
- */
- public static String getRandomString(final String prefix, int length) throws SecurityException {
- String usedPrefix = (prefix == null ? "" : prefix);
-
- int idLength = length - usedPrefix.length();
- return usedPrefix + createSaltString(idLength);
- }
-
-
- /* *** private methods *** */
- /**
- * creates a salt and returns the value as byte[]
- *
- * @param saltLength the length the salt string should have
- * @return the generated salt as byte[]
- *
- * @throws SecurityException if the salt creation fails
- */
- private static byte[] createSalt(int saltLength) throws SecurityException {
- try {
- SecureRandom sha1SecureRandom = SecureRandom.getInstance("SHA1PRNG");
-
- byte salt[] = new byte[saltLength];
- synchronized (sha1SecureRandom) {
- sha1SecureRandom.nextBytes(salt);
- }
- return salt;
- } catch (Exception ex) {
- throw new SecurityException("Cannot created salt", ex);
- }
- }
-
- /**
- * hashes the given password (md5 hashed, base64 coded) with the given salt
- *
- * @param text the text to salt
- * @param salt the salt to use
- * @return the input text salted with password
- *
- * @throws SecurityException
- */
- private static byte[] hashPasswordWithSalt(byte text[], byte salt[]) throws SecurityException {
- try {
- MessageDigest sha1Algorithm = MessageDigest.getInstance("SHA-1");
- byte[] digest;
- synchronized (sha1Algorithm) {
- sha1Algorithm.reset();
- sha1Algorithm.update(salt);
- digest = sha1Algorithm.digest(text);
- }
- return digest;
- } catch (NoSuchAlgorithmException ex) {
- throw new SecurityException("Cannot hash password with salt", ex);
- }
- }
-
- /**
- * returns the given password as md5 without appliying salt
- *
- * @param plainTextPassword the password to convert
- * @return the given password as md5 without appliying salt
- *
- * @throws SecurityException if the passwor cannot be converted
- */
- private static byte[] getBase64MD5HashedPassword(final String plainTextPassword) throws SecurityException {
- try {
- MessageDigest algorithm = MessageDigest.getInstance("MD5");
- algorithm.reset();
- algorithm.update(plainTextPassword.getBytes());
- byte[] messageDigest = algorithm.digest();
- StringBuilder buf = new StringBuilder();
- for (int i = 0; i < messageDigest.length; i++) {
- int halfbyte = (messageDigest[i] >>> 4) & 0x0F;
- int twoHalfs = 0;
- do {
- if ((0 <= halfbyte) && (halfbyte <= 9)) {
- buf.append((char) ('0' + halfbyte));
- } else {
- buf.append((char) ('a' + (halfbyte - 10)));
- }
- halfbyte = messageDigest[i] & 0x0F;
- } while (twoHalfs++ < 1);
- }
-
- // take password and hash with salt
- byte[] unHashedPassword = base64Decode(buf.toString());
-
- return unHashedPassword;
- } catch (Exception ex) {
- throw new SecurityException("Cannot created password", ex);
- }
- }
-
- /**
- * returns the plain byte[] as base64 coded string
- *
- * @param data the data to convert
- * @return the plain byte[] as base64 coded string
- */
- private static String base64Encode(final byte[] data) {
- Base64 encoder = new Base64();
- byte[] result = encoder.encode(data);
- return new String(result);
- }
-
- /**
- * returns the given base64 coded string as decoded byte[]
- *
- * @param data the string to convert
- * @return the given base64 coded string as decoded byte[]
- */
- private static byte[] base64Decode(final String data) {
- Base64 decoder = new Base64();
- return decoder.decode(data.getBytes());
- }
-
-
- /**
- * returns the crypted parameter string for the given plain text password
- *
- * @param plainPassword the plain text password to crypt
- * @return the crypted password string
- */
- public static String getScryptHash(String plainPassword) {
- return scrypt(plainPassword, scryptCpuCostParameter, scryptMemCostParameter, scryptParallelizationParameter);
- }
-
- /**
- * returns true, if the given plainPassword re-encrypted matches the given crypted password
- *
- * @param plainPassword the plain password to validate
- * @param hashedPassword the encrypted password to validate against
- * @return true, if the encrypted string of the given plain password matches the provided crypted password
- */
- public static boolean validateScryptHash(String plainPassword, String hashedPassword) {
- return check(plainPassword, hashedPassword);
- }
-}
diff --git a/security/src/main/java/de/muehlencord/shared/security/PasswordUtil.java b/security/src/main/java/de/muehlencord/shared/security/PasswordUtil.java
deleted file mode 100644
index 50769e8..0000000
--- a/security/src/main/java/de/muehlencord/shared/security/PasswordUtil.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package de.muehlencord.shared.security;
-
-import java.security.SecureRandom;
-import org.bouncycastle.crypto.generators.SCrypt;
-import org.bouncycastle.util.encoders.Base64;
-
-/**
- * TODO: migrate to shared library
- *
- * @author joern.muehlencord
- */
-public class PasswordUtil {
-
- private final static SecureRandom SECURERANDOM = new SecureRandom();
-
- private final static int CPU_MEMORY_COST_PARAMETER = 16384;
- private final static int BLOCK_SIZE = 8;
- private final static int PARALLELIZATION = 1;
- private final static int KEY_LENGTH = 32;
-
- private final String systemsalt;
-
- public PasswordUtil(String systemSaltBase64Coded) {
- // TODO make some tests like lengths etc
- this.systemsalt = systemSaltBase64Coded;
- }
-
- public String getHash(String clearPassword) {
-
- // generate user salt
- byte[] userSaltBytes = new byte[32];
- SECURERANDOM.nextBytes(userSaltBytes);
- String userSalt = new String(Base64.encode(userSaltBytes));
-
- // create passwordhash with salt
- String passwordHash = getPasswordHash(systemsalt, userSalt, clearPassword);
-
- StringBuilder sb = new StringBuilder();
- sb.append(userSalt);
- sb.append(":");
- sb.append(passwordHash);
-
- return sb.toString();
- }
-
- public boolean matches(String clearPassword, String passwordHashWithSalt) {
- if (!passwordHashWithSalt.contains(":")) {
- // TODO add exception handling
- return false;
- }
-
- String userSalt = passwordHashWithSalt.substring(0, passwordHashWithSalt.indexOf(":"));
- String passwordHash = passwordHashWithSalt.substring(passwordHashWithSalt.indexOf(":")+1);
-
- String validationHash = getPasswordHash(systemsalt, userSalt, clearPassword);
- return validationHash.equals(passwordHash);
- }
-
- private String getPasswordHash(String systemSaltBase64, String userSaltBase64, String clearPassword) {
- byte[] systemSalt = systemSaltBase64.getBytes();
- byte[] userSalt = userSaltBase64.getBytes();
- byte[] salt = new byte[systemSalt.length + userSalt.length];
-
- System.arraycopy(systemSalt, 0, salt, 0, systemSalt.length);
- System.arraycopy(userSalt, 0, salt, systemSalt.length, userSalt.length);
-
- return new String(Base64.encode(SCrypt.generate(clearPassword.getBytes(), salt, CPU_MEMORY_COST_PARAMETER, BLOCK_SIZE, PARALLELIZATION, KEY_LENGTH)));
- }
-}
diff --git a/security/src/main/java/de/muehlencord/shared/security/SecurityException.java b/security/src/main/java/de/muehlencord/shared/security/SecurityException.java
deleted file mode 100644
index 6c3dd46..0000000
--- a/security/src/main/java/de/muehlencord/shared/security/SecurityException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- */
-
-package de.muehlencord.shared.security;
-
-/**
- *
- * @author joern@muehlencord.de
- */
-public class SecurityException extends Exception {
-
- public SecurityException() {
- super ("An error occured during a security action");
- }
-
- public SecurityException(String msg) {
- super (msg);
- }
-
- public SecurityException(String msg, Throwable cause) {
- super(msg, cause);
- }
-
- public SecurityException(Throwable cause) {
- super (cause);
- }
-
-
-}
diff --git a/security/src/test/java/de/muehlencord/shared/security/LuhnTest.java b/security/src/test/java/de/muehlencord/shared/security/LuhnTest.java
deleted file mode 100644
index 2096e6b..0000000
--- a/security/src/test/java/de/muehlencord/shared/security/LuhnTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * File: $$RCSfile$$
- *
- * Copyright (c) 2011 by Wincor Nixdorf,
- * Heinz-Nixdorf-Ring 1, 33106 Paderborn, Germany
- *
- * This software is the confidential and proprietary information
- * of Wincor Nixdorf.
- *
- * You shall not disclose such confidential information and shall
- * use it only in accordance with the terms of the license agreement
- * you entered into with Wincor Nixdorf.
- */
-package de.muehlencord.shared.security;
-
-import static de.muehlencord.shared.security.Luhn.computeCheckDigit;
-import static de.muehlencord.shared.security.Luhn.validateNumber;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.jupiter.api.Test;
-
-/**
- *
- * @author joern.muehlencord
- */
-public class LuhnTest {
-
- public LuhnTest() {
- }
-
- @Test
- public void testComputeCheckDigit() {
- String testString = "7992739871";
- int checkNumber = computeCheckDigit(testString, false);
- System.out.println(checkNumber);
- assertTrue(checkNumber == 3);
- }
-
- @Test
- public void testValidateNumber() {
- assertFalse(validateNumber("79927398710"));
- assertFalse(validateNumber("79927398711"));
- assertFalse(validateNumber("79927398712"));
- assertTrue(validateNumber("79927398713"));
- assertFalse(validateNumber("79927398714"));
- assertFalse(validateNumber("79927398715"));
- assertFalse(validateNumber("79927398716"));
- assertFalse(validateNumber("79927398717"));
- assertFalse(validateNumber("79927398718"));
- assertFalse(validateNumber("79927398719"));
- }
-
-}
-
-/**
- * History:
- *
- * $$Log$$
- *
- */
diff --git a/security/src/test/java/de/muehlencord/shared/security/OldPasswordUtilTest.java b/security/src/test/java/de/muehlencord/shared/security/OldPasswordUtilTest.java
deleted file mode 100644
index dd956f4..0000000
--- a/security/src/test/java/de/muehlencord/shared/security/OldPasswordUtilTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package de.muehlencord.shared.security;
-
-import static de.muehlencord.shared.security.OldPasswordUtil.getScryptHash;
-import static de.muehlencord.shared.security.OldPasswordUtil.validateScryptHash;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNotSame;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.jupiter.api.Test;
-
-/**
- *
- * @author jomu
- */
-public class OldPasswordUtilTest {
-
- /**
- * Test of createSaltString method, of class PasswordUtil.
- */
- @Test
- public void createSaltString() throws Exception {
- System.out.println("createSaltString");
- int saltLength = 40;
- String result = OldPasswordUtil.createSaltString(saltLength);
- assertNotNull(result);
- }
-
- /**
- * Test of getMD5Password method, of class PasswordUtil.
- */
- @Test
- public void getMD5Password() throws Exception {
- System.out.println("getMD5Password");
- String plainTextPassword = "";
- int saltLength = 40;
- String[] result1 = OldPasswordUtil.getMD5Password(plainTextPassword, saltLength);
- String password1 = result1[0];
- String salt1 = result1[1];
- assertNotNull(result1);
- assertNotNull(password1);
- assertNotNull(salt1);
-
- String[] result2 = OldPasswordUtil.getMD5Password(plainTextPassword, saltLength);
- String password2 = result2[0];
- String salt2 = result2[1];
- assertNotNull(result2);
- assertNotNull(password2);
- assertNotNull(salt2);
-
- assertNotSame(result1, result2);
- assertNotSame(password1, password2);
- assertNotSame(salt1, salt2);
- }
-
- /**
- * Test of checkPassword method, of class PasswordUtil.
- */
- @Test
- public void checkPassword() throws Exception {
- System.out.println("checkPassword");
- String plainTextPassword = "welcome";
- String plainTextPassword2 = "this is not the correct password";
-
- String[] data = OldPasswordUtil.getMD5Password(plainTextPassword, 40);
- String cryptedPassword = data[0];
- String salt = data[1];
-
- String salt2 = OldPasswordUtil.createSaltString(40);
- String salt3 = OldPasswordUtil.createSaltString(10);
-
- boolean expResult = true;
- boolean result = OldPasswordUtil.checkPassword(plainTextPassword, cryptedPassword, salt);
- assertTrue(expResult == result);
-
- expResult = false;
- result = OldPasswordUtil.checkPassword(plainTextPassword2, cryptedPassword, salt);
- assertTrue(expResult == result);
-
- expResult = false;
- result = OldPasswordUtil.checkPassword(plainTextPassword, cryptedPassword, salt2);
- assertTrue(expResult == result);
-
- expResult = false;
- result = OldPasswordUtil.checkPassword(plainTextPassword, cryptedPassword, salt3);
- assertTrue(expResult == result);
- }
-
- @Test
- public void getRandomString() throws SecurityException {
- System.out.println("getRandomString");
- String randomString = OldPasswordUtil.getRandomString("test-", 32);
- System.out.println(randomString);
- assertNotNull(randomString);
- assertTrue(randomString.startsWith("test"), "string must start with prefix");
- assertTrue(32 == randomString.length(), "string length check");
-
- String randomString2 = OldPasswordUtil.getRandomString("test-", 32);
- System.out.println(randomString2);
- assertNotNull(randomString2);
- assertTrue(randomString2.startsWith("test"), "string must start with prefix");
- assertTrue(32 == randomString2.length(), "string length check");
-
- assertNotSame(randomString, randomString2);
- }
-
- @Test
- public void getRandomStringBlankPrefix() throws SecurityException {
- System.out.println("getRandomStringBlankPrefix");
- String randomString = OldPasswordUtil.getRandomString("", 32);
- System.out.println(randomString);
- assertNotNull(randomString);
- assertTrue(32 == randomString.length(), "string length check");
- }
-
- @Test
- public void getRandomStringNullPrefix() throws SecurityException {
- System.out.println("getRandomStringNullPrefix");
- String randomString = OldPasswordUtil.getRandomString(null, 32);
- System.out.println(randomString);
- assertNotNull(randomString);
- assertTrue(32 == randomString.length(), "string length check");
- }
-
- /**
- * test the hashPassword method
- */
- @Test
- public void testGetScryptHash() {
- String hash1 = getScryptHash("secret");
- String hash2 = getScryptHash("secret");
- System.out.println(hash1);
- System.out.println(hash2);
- assertNotNull(hash1);
- assertNotNull(hash2);
- // even if password is the same, the has must not be the same due to correct usage of salts
- assertFalse(hash1.equals(hash2));
-
- assertTrue(hash1.length() == 79);
- assertTrue(hash2.length() == 79);
- }
-
- /**
- * test for validating passwords
- */
- @Test
- public void testValidateScryptHash() {
- String hash1 = getScryptHash("secret");
- String hash2 = getScryptHash("secret");
- assertTrue(validateScryptHash("secret", hash1), "hash must match if correct password is given");
- assertTrue(validateScryptHash("secret", hash2), "hash must match if correct password is given");
- assertFalse(validateScryptHash("secret2", hash1), "hash must not match if wrong password is given");
- }
-
-}
diff --git a/security/src/test/java/de/muehlencord/shared/security/PasswordUtilTest.java b/security/src/test/java/de/muehlencord/shared/security/PasswordUtilTest.java
deleted file mode 100644
index 9585872..0000000
--- a/security/src/test/java/de/muehlencord/shared/security/PasswordUtilTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package de.muehlencord.shared.security;
-
-import java.security.SecureRandom;
-import org.bouncycastle.util.encoders.Base64;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-
-/**
- *
- * @author joern.muehlencord
- */
-public class PasswordUtilTest {
-
- private static SecureRandom secureRandom;
- private static String systemSalt64Coded;
- private static byte[] systemSaltBytes;
-
- @BeforeAll
- public static void init() {
- secureRandom = new SecureRandom();
-
- systemSaltBytes = new byte[32];
- secureRandom.nextBytes (systemSaltBytes);
- systemSalt64Coded = new String(Base64.encode (systemSaltBytes));
- }
-
-
- @Test
- public void testGetHash() {
- PasswordUtil pwUtil = new PasswordUtil(systemSalt64Coded);
-
- String password1 = pwUtil.getHash("password");
- String password2 = pwUtil.getHash("password");
-
- assertFalse (password1.equals(password2));
- assertTrue (pwUtil.matches ("password", password1));
- assertFalse (pwUtil.matches ("wrongpassword", password1));
-
-
- }
-
-}
diff --git a/shiro-faces/pom.xml b/shiro-faces/pom.xml
index 8acc81b..4b16756 100644
--- a/shiro-faces/pom.xml
+++ b/shiro-faces/pom.xml
@@ -1,4 +1,20 @@
+
+
4.0.0
de.muehlencord.shared
diff --git a/shiro-faces/src/main/java/de/muehlencord/shirofaces/filter/FacesAjaxAwarePassThruAuthenticationFilter.java b/shiro-faces/src/main/java/de/muehlencord/shirofaces/filter/FacesAjaxAwarePassThruAuthenticationFilter.java
index c9be041..af64337 100644
--- a/shiro-faces/src/main/java/de/muehlencord/shirofaces/filter/FacesAjaxAwarePassThruAuthenticationFilter.java
+++ b/shiro-faces/src/main/java/de/muehlencord/shirofaces/filter/FacesAjaxAwarePassThruAuthenticationFilter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 de.muehlencord.shirofaces.filter;
import java.io.IOException;
diff --git a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractAccessControlTag.java b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractAccessControlTag.java
index a7991ff..74f86f8 100644
--- a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractAccessControlTag.java
+++ b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractAccessControlTag.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2016 Joern Muehlencord (joern at muehlencord.de).
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractAuthenticationTag.java b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractAuthenticationTag.java
index 1a1df07..3e8fb85 100644
--- a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractAuthenticationTag.java
+++ b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractAuthenticationTag.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2016 Joern Muehlencord (joern at muehlencord.de).
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractPermissionTag.java b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractPermissionTag.java
index 3705ce2..fbdbd60 100644
--- a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractPermissionTag.java
+++ b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractPermissionTag.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2016 Joern Muehlencord (joern at muehlencord.de).
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractRoleTag.java b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractRoleTag.java
index f86c693..cd438d1 100644
--- a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractRoleTag.java
+++ b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractRoleTag.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2016 Joern Muehlencord (joern at muehlencord.de).
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractTag.java b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractTag.java
index 06fc662..4917444 100644
--- a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractTag.java
+++ b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AbstractTag.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2016 Joern Muehlencord (joern at muehlencord.de).
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AuthenticatedTag.java b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AuthenticatedTag.java
index dddf525..3143dc8 100644
--- a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AuthenticatedTag.java
+++ b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/AuthenticatedTag.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2016 Joern Muehlencord (joern at muehlencord.de).
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/GuestTag.java b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/GuestTag.java
index c8a2102..17bbccb 100644
--- a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/GuestTag.java
+++ b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/GuestTag.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2016 Joern Muehlencord (joern at muehlencord.de).
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/HasAnyPermissionTag.java b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/HasAnyPermissionTag.java
index 17f43b6..8ade43e 100644
--- a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/HasAnyPermissionTag.java
+++ b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/HasAnyPermissionTag.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2016 Joern Muehlencord (joern at muehlencord.de).
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/HasAnyRolesTag.java b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/HasAnyRolesTag.java
index 1ab2827..af953ad 100644
--- a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/HasAnyRolesTag.java
+++ b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/HasAnyRolesTag.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2016 Joern Muehlencord (joern at muehlencord.de).
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/HasPermissionTag.java b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/HasPermissionTag.java
index 545299c..8b690f6 100644
--- a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/HasPermissionTag.java
+++ b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/HasPermissionTag.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2016 Joern Muehlencord (joern at muehlencord.de).
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/HasRoleTag.java b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/HasRoleTag.java
index 43b625b..3125aee 100644
--- a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/HasRoleTag.java
+++ b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/HasRoleTag.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2016 Joern Muehlencord (joern at muehlencord.de).
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/LacksPermissionTag.java b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/LacksPermissionTag.java
index 925d27a..98c102f 100644
--- a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/LacksPermissionTag.java
+++ b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/LacksPermissionTag.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2016 Joern Muehlencord (joern at muehlencord.de).
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/LacksRoleTag.java b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/LacksRoleTag.java
index 527ccb6..05c1433 100644
--- a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/LacksRoleTag.java
+++ b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/LacksRoleTag.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2016 Joern Muehlencord (joern at muehlencord.de).
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/NotAuthenticatedTag.java b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/NotAuthenticatedTag.java
index 9d4aff2..930d778 100644
--- a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/NotAuthenticatedTag.java
+++ b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/NotAuthenticatedTag.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2016 Joern Muehlencord (joern at muehlencord.de).
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/UserTag.java b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/UserTag.java
index 0d52500..6231352 100644
--- a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/UserTag.java
+++ b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/UserTag.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2016 Joern Muehlencord (joern at muehlencord.de).
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/unsupported/PrincipalTag.java b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/unsupported/PrincipalTag.java
index bed72b7..43e66bf 100644
--- a/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/unsupported/PrincipalTag.java
+++ b/shiro-faces/src/main/java/de/muehlencord/shirofaces/tags/unsupported/PrincipalTag.java
@@ -1,5 +1,5 @@
-/*
- * Copyright 2016 Joern Muehlencord (joern at muehlencord.de).
+/*
+ * Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/shiro-faces/src/main/resources/META-INF/shiro-faces.taglib.xml b/shiro-faces/src/main/resources/META-INF/shiro-faces.taglib.xml
index 7d60112..f6721b7 100644
--- a/shiro-faces/src/main/resources/META-INF/shiro-faces.taglib.xml
+++ b/shiro-faces/src/main/resources/META-INF/shiro-faces.taglib.xml
@@ -1,6 +1,6 @@
+
4.0.0