diff --git a/config/alfresco/bootstrap-context.xml b/config/alfresco/bootstrap-context.xml
index 6717d65783..e6cd3c8720 100644
--- a/config/alfresco/bootstrap-context.xml
+++ b/config/alfresco/bootstrap-context.xml
@@ -114,6 +114,7 @@
+
diff --git a/config/alfresco/dbscripts/create/3.0/org.hibernate.dialect.DerbyDialect/create-activities-extras.sql b/config/alfresco/dbscripts/create/3.0/org.hibernate.dialect.DerbyDialect/create-activities-extras.sql
deleted file mode 100644
index 5e816f23e3..0000000000
--- a/config/alfresco/dbscripts/create/3.0/org.hibernate.dialect.DerbyDialect/create-activities-extras.sql
+++ /dev/null
@@ -1,79 +0,0 @@
---
--- Title: Activities Schema - Extras (Indexes, Identity)
--- Database: Derby
--- Since: V3.0.0 Schema
---
-
--- Activity Post
-
--- Hibernate workaround - to add identity column
-DROP TABLE alf_activity_post;
-CREATE TABLE alf_activity_post (
- sequence_id bigint generated by default as identity (start with 1),
- post_date timestamp NOT NULL,
- status varchar(10) NOT NULL,
- activity_data varchar(4000) NOT NULL,
- post_user_id varchar(255) NOT NULL,
- job_task_node integer NOT NULL,
- site_network varchar(255) default NULL,
- app_tool varchar(36) default NULL,
- activity_type varchar(255) NOT NULL,
- last_modified timestamp NOT NULL,
- primary key (sequence_id)
-);
-
-CREATE INDEX post_jobtasknode_idx ON alf_activity_post(job_task_node);
-CREATE INDEX post_status_idx ON alf_activity_post(status);
-
--- Activity Feed
-
--- Hibernate workaround - to add identity column
-DROP TABLE alf_activity_feed;
-CREATE TABLE alf_activity_feed (
- id bigint generated by default as identity (start with 1),
- post_id bigint default NULL,
- post_date timestamp NOT NULL,
- activity_summary varchar(4000) default NULL,
- feed_user_id varchar(255) NOT NULL,
- activity_type varchar(255) NOT NULL,
- activity_format varchar(10) default NULL,
- site_network varchar(255) default NULL,
- app_tool varchar(36) default NULL,
- post_user_id varchar(255) NOT NULL,
- feed_date timestamp NOT NULL,
- primary key (id)
-);
-
-CREATE INDEX feed_postdate_idx ON alf_activity_feed(post_date);
-CREATE INDEX feed_postuserid_idx ON alf_activity_feed(post_user_id);
-CREATE INDEX feed_feeduserid_idx ON alf_activity_feed(feed_user_id);
-CREATE INDEX feed_sitenetwork_idx ON alf_activity_feed(site_network);
-CREATE INDEX feed_activityformat_idx ON alf_activity_feed(activity_format);
-
--- Activity Feed Control
-
--- Hibernate workaround - to add identity column
-DROP TABLE alf_activity_feed_control;
-CREATE TABLE alf_activity_feed_control (
- id bigint generated by default as identity (start with 1),
- feed_user_id varchar(255) NOT NULL,
- site_network varchar(255) NOT NULL,
- app_tool varchar(36) default NULL,
- last_modified timestamp NOT NULL,
- primary key (id)
-);
-
-CREATE INDEX feedctrl_feeduserid_idx ON alf_activity_feed_control(feed_user_id);
-
-
---
--- Record script finish
---
-DELETE FROM alf_applied_patch WHERE id = 'patch.db-V3.0-0-CreateActivitiesExtras';
-INSERT INTO alf_applied_patch
- (id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
- VALUES
- (
- 'patch.db-V3.0-0-CreateActivitiesExtras', 'Executed script create V3.0: Created activities extras',
- 0, 125, -1, 126, CURRENT_TIMESTAMP, 'UNKNOWN', 1, 1, 'Script completed'
- );
\ No newline at end of file
diff --git a/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.DerbyDialect/AlfrescoPostCreate-3.2-ContentTables.sql b/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.DerbyDialect/AlfrescoPostCreate-3.2-ContentTables.sql
deleted file mode 100644
index 0af906a017..0000000000
--- a/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.DerbyDialect/AlfrescoPostCreate-3.2-ContentTables.sql
+++ /dev/null
@@ -1,74 +0,0 @@
---
--- Title: Create Content tables
--- Database: Derby
--- Since: V3.2 Schema 2012
--- Author: Derek Hulley
---
--- Please contact support@alfresco.com if you need assistance with the upgrade.
---
-
-CREATE TABLE alf_mimetype
-(
- id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
- version BIGINT NOT NULL,
- mimetype_str VARCHAR(100) NOT NULL,
- PRIMARY KEY (id),
- UNIQUE (mimetype_str)
-);
-
-CREATE TABLE alf_encoding
-(
- id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
- version BIGINT NOT NULL,
- encoding_str VARCHAR(100) NOT NULL,
- PRIMARY KEY (id),
- UNIQUE (encoding_str)
-);
-
--- This table may exist during upgrades, but must be removed.
--- The drop statement is therefore optional.
-DROP TABLE alf_content_url; --(optional)
-CREATE TABLE alf_content_url
-(
- id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
- version BIGINT NOT NULL,
- content_url VARCHAR(255) NOT NULL,
- content_url_short VARCHAR(12) NOT NULL,
- content_url_crc BIGINT NOT NULL,
- content_size BIGINT NOT NULL,
- CONSTRAINT idx_alf_cont_url_crc UNIQUE (content_url_short, content_url_crc),
- PRIMARY KEY (id)
-);
-
-CREATE TABLE alf_content_data
-(
- id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
- version BIGINT NOT NULL,
- content_url_id BIGINT,
- content_mimetype_id BIGINT,
- content_encoding_id BIGINT,
- content_locale_id BIGINT,
- CONSTRAINT fk_alf_cont_url FOREIGN KEY (content_url_id) REFERENCES alf_content_url (id),
- CONSTRAINT fk_alf_cont_mim FOREIGN KEY (content_mimetype_id) REFERENCES alf_mimetype (id),
- CONSTRAINT fk_alf_cont_enc FOREIGN KEY (content_encoding_id) REFERENCES alf_encoding (id),
- CONSTRAINT fk_alf_cont_loc FOREIGN KEY (content_locale_id) REFERENCES alf_locale (id),
- PRIMARY KEY (id)
-);
-
-CREATE TABLE alf_content_clean
-(
- content_url VARCHAR(255) NOT NULL
-);
-CREATE INDEX idx_alf_contentclean_url ON alf_content_clean(content_url);
-
---
--- Record script finish
---
-DELETE FROM alf_applied_patch WHERE id = 'patch.db-V3.2-ContentTables';
-INSERT INTO alf_applied_patch
- (id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
- VALUES
- (
- 'patch.db-V3.2-ContentTables', 'Manually executed script upgrade V3.2: Content Tables',
- 0, 2011, -1, 2012, null, 'UNKOWN', 1, 1, 'Script completed'
- );
\ No newline at end of file
diff --git a/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.DerbyDialect/AlfrescoPostCreate-3.2-LockTables.sql b/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.DerbyDialect/AlfrescoPostCreate-3.2-LockTables.sql
deleted file mode 100644
index c75402b43e..0000000000
--- a/config/alfresco/dbscripts/create/3.2/org.hibernate.dialect.DerbyDialect/AlfrescoPostCreate-3.2-LockTables.sql
+++ /dev/null
@@ -1,46 +0,0 @@
---
--- Title: Create lock tables
--- Database: Derby
--- Since: V3.2 Schema 2011
--- Author: Derek Hulley
---
--- Please contact support@alfresco.com if you need assistance with the upgrade.
---
-
-CREATE TABLE alf_lock_resource
-(
- id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
- version BIGINT NOT NULL,
- qname_ns_id BIGINT NOT NULL,
- qname_localname VARCHAR(255) NOT NULL,
- CONSTRAINT fk_alf_lockr_ns FOREIGN KEY (qname_ns_id) REFERENCES alf_namespace (id),
- CONSTRAINT fk_alf_lockr_id PRIMARY KEY (id),
- CONSTRAINT idx_alf_lockr_key UNIQUE (qname_ns_id, qname_localname)
-);
-
-CREATE TABLE alf_lock
-(
- id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
- version BIGINT NOT NULL,
- shared_resource_id BIGINT NOT NULL,
- excl_resource_id BIGINT NOT NULL,
- lock_token VARCHAR(36) NOT NULL,
- start_time BIGINT NOT NULL,
- expiry_time BIGINT NOT NULL,
- CONSTRAINT fk_alf_lock_shared FOREIGN KEY (shared_resource_id) REFERENCES alf_lock_resource (id),
- CONSTRAINT fk_alf_lock_excl FOREIGN KEY (excl_resource_id) REFERENCES alf_lock_resource (id),
- CONSTRAINT fk_alf_lock_id PRIMARY KEY (id),
- CONSTRAINT idx_alf_lock_key UNIQUE (shared_resource_id, excl_resource_id)
-);
-
---
--- Record script finish
---
-DELETE FROM alf_applied_patch WHERE id = 'patch.db-V3.2-LockTables';
-INSERT INTO alf_applied_patch
- (id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
- VALUES
- (
- 'patch.db-V3.2-LockTables', 'Manually executed script upgrade V3.2: Lock Tables',
- 0, 2010, -1, 2011, null, 'UNKOWN', 1, 1, 'Script completed'
- );
\ No newline at end of file
diff --git a/config/alfresco/dbscripts/upgrade/3.1/org.hibernate.dialect.MySQLInnoDBDialect/IPv6-patch.sql b/config/alfresco/dbscripts/upgrade/3.1/org.hibernate.dialect.MySQLInnoDBDialect/IPv6-patch.sql
new file mode 100644
index 0000000000..feb51a9e3f
--- /dev/null
+++ b/config/alfresco/dbscripts/upgrade/3.1/org.hibernate.dialect.MySQLInnoDBDialect/IPv6-patch.sql
@@ -0,0 +1,21 @@
+--
+-- Title: Increase the ipAddress field length to allow IPv6 adresses
+-- Database: MySQL
+-- Since: V3.1 schema 1009
+--
+-- Please contact support@alfresco.com if you need assistance with the upgrade.
+--
+
+ALTER TABLE alf_server MODIFY ip_address varchar(39) NOT NULL;
+
+--
+-- Record script finish
+--
+DELETE FROM alf_applied_patch WHERE id = 'patch.db-V3.1-Allow-IPv6';
+INSERT INTO alf_applied_patch
+ (id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
+ VALUES
+ (
+ 'patch.db-V3.1-Allow-IPv6', 'Manually executed script upgrade V3.1: Increase the ipAddress field length',
+ 0, 2019, -1, 2020, null, 'UNKOWN', 1, 1, 'Script completed'
+ );
diff --git a/config/alfresco/ibatis/org.hibernate.dialect.DerbyDialect/activities-insert-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.DerbyDialect/activities-insert-SqlMap.xml
deleted file mode 100644
index b6872d2dd3..0000000000
--- a/config/alfresco/ibatis/org.hibernate.dialect.DerbyDialect/activities-insert-SqlMap.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
- insert into alf_activity_feed_control (id, feed_user_id, site_network, app_tool, last_modified)
- values (DEFAULT, #feedUserId#, #siteNetwork#, #appTool#, #lastModified#)
-
-
-
- values IDENTITY_VAL_LOCAL()
-
-
-
-
- insert into alf_activity_feed (id, activity_type, activity_summary, activity_format, feed_user_id, post_user_id, post_date, post_id, site_network, app_tool, feed_date)
- values (DEFAULT, #activityType#, #activitySummary#, #activitySummaryFormat#, #feedUserId#, #postUserId#, #postDate#, #postId#, #siteNetwork#, #appTool#, #feedDate#)
-
-
-
- values IDENTITY_VAL_LOCAL()
-
-
-
-
- insert into alf_activity_post (sequence_id, status, activity_data, post_user_id, post_date, activity_type, site_network, app_tool, job_task_node, last_modified)
- values (DEFAULT, #status#, #activityData#, #userId#, #postDate#, #activityType#, #siteNetwork#, #appTool#, #jobTaskNode#, #lastModified#)
-
-
-
- values IDENTITY_VAL_LOCAL()
-
-
-
-
\ No newline at end of file
diff --git a/config/alfresco/ibatis/org.hibernate.dialect.DerbyDialect/content-insert-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.DerbyDialect/content-insert-SqlMap.xml
deleted file mode 100644
index 404d6de512..0000000000
--- a/config/alfresco/ibatis/org.hibernate.dialect.DerbyDialect/content-insert-SqlMap.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
-
-
- values IDENTITY_VAL_LOCAL()
-
-
-
-
-
-
- values IDENTITY_VAL_LOCAL()
-
-
-
-
-
-
- values IDENTITY_VAL_LOCAL()
-
-
-
-
-
-
- values IDENTITY_VAL_LOCAL()
-
-
-
-
\ No newline at end of file
diff --git a/config/alfresco/ibatis/org.hibernate.dialect.DerbyDialect/locks-insert-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.DerbyDialect/locks-insert-SqlMap.xml
deleted file mode 100644
index c5e827d0c5..0000000000
--- a/config/alfresco/ibatis/org.hibernate.dialect.DerbyDialect/locks-insert-SqlMap.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
- values IDENTITY_VAL_LOCAL()
-
-
-
-
-
-
- values IDENTITY_VAL_LOCAL()
-
-
-
-
\ No newline at end of file
diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml
index d994b882b8..29bf95fe9d 100644
--- a/config/alfresco/patch/patch-services-context.xml
+++ b/config/alfresco/patch/patch-services-context.xml
@@ -1842,8 +1842,8 @@
-
-
+
+
patch.db-V3.2-ContentTables
patch.schemaUpgradeScript.description
0
@@ -1921,4 +1921,16 @@
+
+ patch.db-V3.1-Allow-IPv6
+ patch.schemaUpgradeScript.description
+ 0
+ 3003
+ 3004
+
+
+ classpath:alfresco/dbscripts/upgrade/3.1/${db.script.dialect}/IPv6-patch.sql
+
+
+
diff --git a/config/alfresco/version.properties b/config/alfresco/version.properties
index 0582eee5fc..ccf92d5bb2 100644
--- a/config/alfresco/version.properties
+++ b/config/alfresco/version.properties
@@ -19,4 +19,4 @@ version.build=@build-number@
# Schema number
-version.schema=3003
+version.schema=3004
diff --git a/source/java/org/alfresco/repo/domain/hibernate/Transaction.hbm.xml b/source/java/org/alfresco/repo/domain/hibernate/Transaction.hbm.xml
index af0902e554..e02a687697 100644
--- a/source/java/org/alfresco/repo/domain/hibernate/Transaction.hbm.xml
+++ b/source/java/org/alfresco/repo/domain/hibernate/Transaction.hbm.xml
@@ -50,7 +50,7 @@
-
+
diff --git a/source/java/org/alfresco/repo/security/authentication/AuthenticationContextImpl.java b/source/java/org/alfresco/repo/security/authentication/AuthenticationContextImpl.java
index ff08c27c0c..52154e14ea 100644
--- a/source/java/org/alfresco/repo/security/authentication/AuthenticationContextImpl.java
+++ b/source/java/org/alfresco/repo/security/authentication/AuthenticationContextImpl.java
@@ -1,149 +1,149 @@
-/*
- * Copyright (C) 2005-2009 Alfresco Software Limited.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
- * As a special exception to the terms and conditions of version 2.0 of
- * the GPL, you may redistribute this Program in connection with Free/Libre
- * and Open Source Software ("FLOSS") applications as described in Alfresco's
- * FLOSS exception. You should have received a copy of the text describing
- * the FLOSS exception, and it is also available here:
- * http://www.alfresco.com/legal/licensing"
- */
-package org.alfresco.repo.security.authentication;
-
-import net.sf.acegisecurity.Authentication;
-import net.sf.acegisecurity.GrantedAuthority;
-import net.sf.acegisecurity.GrantedAuthorityImpl;
-import net.sf.acegisecurity.UserDetails;
-import net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken;
-import net.sf.acegisecurity.providers.dao.User;
-
-import org.alfresco.repo.tenant.TenantService;
-import org.alfresco.service.cmr.security.PermissionService;
-
-/**
- * @author Andy Hind
- * @author dward
- */
-public class AuthenticationContextImpl implements AuthenticationContext
-{
- private TenantService tenantService;
-
- public void setTenantService(TenantService tenantService)
- {
- this.tenantService = tenantService;
- }
-
- /**
- * Explicitly set the given validated user details to be authenticated.
- *
- * @param ud
- * the User Details
- * @return Authentication
- */
- public Authentication setUserDetails(UserDetails ud)
- {
- try
- {
- UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(ud, "", ud
- .getAuthorities());
- auth.setDetails(ud);
- auth.setAuthenticated(true);
- return setCurrentAuthentication(auth);
- }
- catch (net.sf.acegisecurity.AuthenticationException ae)
- {
- throw new AuthenticationException(ae.getMessage(), ae);
- }
- finally
- {
- // Support for logging tenantdomain / username (via log4j NDC)
- AuthenticationUtil.logNDC(ud.getUsername());
- }
- }
-
- public Authentication setSystemUserAsCurrentUser()
- {
- return setSystemUserAsCurrentUser(TenantService.DEFAULT_DOMAIN);
- }
-
- public Authentication setSystemUserAsCurrentUser(String tenantDomain)
- {
- GrantedAuthority[] gas = new GrantedAuthority[1];
- gas[0] = new GrantedAuthorityImpl("ROLE_SYSTEM");
- return setUserDetails(new User(getSystemUserName(tenantDomain), "", true, true, true, true, gas));
- }
-
- public String getSystemUserName()
- {
- return AuthenticationUtil.SYSTEM_USER_NAME;
- }
-
- public String getSystemUserName(String tenantDomain)
- {
- return this.tenantService.getDomainUser(getSystemUserName(), tenantDomain);
- }
-
- public boolean isSystemUserName(String userName)
- {
- return getSystemUserName().equals(this.tenantService.getBaseNameUser(userName));
- }
-
- public boolean isCurrentUserTheSystemUser()
- {
- return isSystemUserName(getCurrentUserName());
- }
-
- public String getGuestUserName(String tenantDomain)
- {
- return this.tenantService.getDomainUser(getGuestUserName(), tenantDomain);
- }
-
- public String getGuestUserName()
- {
- return PermissionService.GUEST_AUTHORITY.toLowerCase();
- }
-
- public boolean isGuestUserName(String userName)
- {
- return PermissionService.GUEST_AUTHORITY.equalsIgnoreCase(this.tenantService.getBaseNameUser(userName));
- }
-
- public Authentication setCurrentAuthentication(Authentication authentication)
- {
- return AuthenticationUtil.setFullAuthentication(authentication);
- }
-
- public Authentication getCurrentAuthentication() throws AuthenticationException
- {
- return AuthenticationUtil.getFullAuthentication();
- }
-
- public String getCurrentUserName() throws AuthenticationException
- {
- return AuthenticationUtil.getFullyAuthenticatedUser();
- }
-
- public void clearCurrentSecurityContext()
- {
- AuthenticationUtil.clearCurrentSecurityContext();
- }
-
- public String getUserDomain(String userName)
- {
- return this.tenantService.getUserDomain(userName);
- }
-}
+/*
+ * Copyright (C) 2005-2009 Alfresco Software Limited.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ * As a special exception to the terms and conditions of version 2.0 of
+ * the GPL, you may redistribute this Program in connection with Free/Libre
+ * and Open Source Software ("FLOSS") applications as described in Alfresco's
+ * FLOSS exception. You should have received a copy of the text describing
+ * the FLOSS exception, and it is also available here:
+ * http://www.alfresco.com/legal/licensing"
+ */
+package org.alfresco.repo.security.authentication;
+
+import net.sf.acegisecurity.Authentication;
+import net.sf.acegisecurity.GrantedAuthority;
+import net.sf.acegisecurity.GrantedAuthorityImpl;
+import net.sf.acegisecurity.UserDetails;
+import net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken;
+import net.sf.acegisecurity.providers.dao.User;
+
+import org.alfresco.repo.tenant.TenantService;
+import org.alfresco.service.cmr.security.PermissionService;
+
+/**
+ * @author Andy Hind
+ * @author dward
+ */
+public class AuthenticationContextImpl implements AuthenticationContext
+{
+ private TenantService tenantService;
+
+ public void setTenantService(TenantService tenantService)
+ {
+ this.tenantService = tenantService;
+ }
+
+ /**
+ * Explicitly set the given validated user details to be authenticated.
+ *
+ * @param ud
+ * the User Details
+ * @return Authentication
+ */
+ public Authentication setUserDetails(UserDetails ud)
+ {
+ try
+ {
+ UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(ud, "", ud
+ .getAuthorities());
+ auth.setDetails(ud);
+ auth.setAuthenticated(true);
+ return setCurrentAuthentication(auth);
+ }
+ catch (net.sf.acegisecurity.AuthenticationException ae)
+ {
+ throw new AuthenticationException(ae.getMessage(), ae);
+ }
+ finally
+ {
+ // Support for logging tenantdomain / username (via log4j NDC)
+ AuthenticationUtil.logNDC(ud.getUsername());
+ }
+ }
+
+ public Authentication setSystemUserAsCurrentUser()
+ {
+ return setSystemUserAsCurrentUser(TenantService.DEFAULT_DOMAIN);
+ }
+
+ public Authentication setSystemUserAsCurrentUser(String tenantDomain)
+ {
+ GrantedAuthority[] gas = new GrantedAuthority[1];
+ gas[0] = new GrantedAuthorityImpl("ROLE_SYSTEM");
+ return setUserDetails(new User(getSystemUserName(tenantDomain), "", true, true, true, true, gas));
+ }
+
+ public String getSystemUserName()
+ {
+ return AuthenticationUtil.SYSTEM_USER_NAME;
+ }
+
+ public String getSystemUserName(String tenantDomain)
+ {
+ return this.tenantService.getDomainUser(getSystemUserName(), tenantDomain);
+ }
+
+ public boolean isSystemUserName(String userName)
+ {
+ return getSystemUserName().equals(this.tenantService.getBaseNameUser(userName));
+ }
+
+ public boolean isCurrentUserTheSystemUser()
+ {
+ return isSystemUserName(getCurrentUserName());
+ }
+
+ public String getGuestUserName(String tenantDomain)
+ {
+ return this.tenantService.getDomainUser(getGuestUserName(), tenantDomain);
+ }
+
+ public String getGuestUserName()
+ {
+ return AuthenticationUtil.getGuestUserName();
+ }
+
+ public boolean isGuestUserName(String userName)
+ {
+ return AuthenticationUtil.getGuestUserName().equalsIgnoreCase(this.tenantService.getBaseNameUser(userName));
+ }
+
+ public Authentication setCurrentAuthentication(Authentication authentication)
+ {
+ return AuthenticationUtil.setFullAuthentication(authentication);
+ }
+
+ public Authentication getCurrentAuthentication() throws AuthenticationException
+ {
+ return AuthenticationUtil.getFullAuthentication();
+ }
+
+ public String getCurrentUserName() throws AuthenticationException
+ {
+ return AuthenticationUtil.getFullyAuthenticatedUser();
+ }
+
+ public void clearCurrentSecurityContext()
+ {
+ AuthenticationUtil.clearCurrentSecurityContext();
+ }
+
+ public String getUserDomain(String userName)
+ {
+ return this.tenantService.getUserDomain(userName);
+ }
+}