mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-02 17:35:18 +00:00
Fixes for "AuthenticationService" to allow log in as guset.
Fixdes for guset in all group in the open world git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2174 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
9d432121bc
commit
7832a14c40
@ -603,7 +603,6 @@
|
||||
org.alfresco.service.cmr.security.AuthenticationService.deleteAuthentication=ACL_METHOD.ROLE_ADMINISTRATOR
|
||||
org.alfresco.service.cmr.security.AuthenticationService.setAuthenticationEnabled=ACL_METHOD.ROLE_ADMINISTRATOR
|
||||
org.alfresco.service.cmr.security.AuthenticationService.getAuthenticationEnabled=ACL_METHOD.ROLE_ADMINISTRATOR
|
||||
org.alfresco.service.cmr.security.AuthenticationService.authenticateAsGuest=ACL_ALLOW
|
||||
org.alfresco.service.cmr.security.AuthenticationService.getCurrentUserName=ACL_ALLOW
|
||||
org.alfresco.service.cmr.security.AuthenticationService.invalidateUserSession=ACL_METHOD.ROLE_ADMINISTRATOR
|
||||
org.alfresco.service.cmr.security.AuthenticationService.invalidateTicket=ACL_ALLOW
|
||||
|
@ -145,6 +145,7 @@ public class AuthenticationTest extends TestCase
|
||||
assertNotNull(personAndyNodeRef);
|
||||
|
||||
deleteAndy();
|
||||
authenticationComponent.clearCurrentSecurityContext();
|
||||
|
||||
}
|
||||
|
||||
@ -178,6 +179,36 @@ public class AuthenticationTest extends TestCase
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
||||
public void xtestScalability()
|
||||
{
|
||||
long create = 0;
|
||||
long count = 0;
|
||||
|
||||
long start;
|
||||
long end;
|
||||
authenticationComponent.authenticate("admin", "admin".toCharArray());
|
||||
for(int i = 0; i < 10000; i++)
|
||||
{
|
||||
String id = "TestUser-"+i;
|
||||
start = System.nanoTime();
|
||||
authenticationService.createAuthentication(id, id.toCharArray());
|
||||
end = System.nanoTime();
|
||||
create += (end - start);
|
||||
|
||||
if((i > 0) && (i % 100 == 0))
|
||||
{
|
||||
System.out.println("Count = "+i);
|
||||
System.out.println("Average create : "+(create/i/1000000.0f));
|
||||
start = System.nanoTime();
|
||||
dao.userExists(id);
|
||||
end = System.nanoTime();
|
||||
System.out.println("Exists : "+((end-start)/1000000.0f));
|
||||
}
|
||||
}
|
||||
authenticationComponent.clearCurrentSecurityContext();
|
||||
}
|
||||
|
||||
public void testCreateAndyUserAndOtherCRUD() throws NoSuchAlgorithmException, UnsupportedEncodingException
|
||||
{
|
||||
RepositoryAuthenticationDao dao = new RepositoryAuthenticationDao();
|
||||
@ -908,6 +939,8 @@ public class AuthenticationTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void testPubAuthenticationService3()
|
||||
{
|
||||
authenticationComponent.setSystemUserAsCurrentUser();
|
||||
@ -941,6 +974,7 @@ public class AuthenticationTest extends TestCase
|
||||
// change the password
|
||||
pubAuthenticationService.setAuthentication("Andy", "auth3".toCharArray());
|
||||
authenticationComponent.clearCurrentSecurityContext();
|
||||
assertNull(authenticationComponent.getCurrentAuthentication());
|
||||
// authenticate again to assert password changed
|
||||
pubAuthenticationService.authenticate("Andy", "auth3".toCharArray());
|
||||
|
||||
@ -949,6 +983,9 @@ public class AuthenticationTest extends TestCase
|
||||
// get the ticket that represents the current user authentication
|
||||
// instance
|
||||
String ticket = pubAuthenticationService.getCurrentTicket();
|
||||
authenticationComponent.clearCurrentSecurityContext();
|
||||
assertNull(authenticationComponent.getCurrentAuthentication());
|
||||
|
||||
// validate our ticket is still valid
|
||||
pubAuthenticationService.validate(ticket);
|
||||
|
||||
@ -967,11 +1004,26 @@ public class AuthenticationTest extends TestCase
|
||||
|
||||
public void testPubAuthenticationService()
|
||||
{
|
||||
//pubAuthenticationService.authenticateAsGuest();
|
||||
//authenticationComponent.clearCurrentSecurityContext();
|
||||
|
||||
assertNull(authenticationComponent.getCurrentAuthentication());
|
||||
authenticationComponent.setSystemUserAsCurrentUser();
|
||||
pubAuthenticationService.createAuthentication("GUEST", "".toCharArray());
|
||||
authenticationComponent.clearCurrentSecurityContext();
|
||||
|
||||
assertNull(authenticationComponent.getCurrentAuthentication());
|
||||
pubAuthenticationService.authenticate("GUEST", "".toCharArray());
|
||||
pubAuthenticationService.authenticate("GUEST", "".toCharArray());
|
||||
authenticationComponent.clearCurrentSecurityContext();
|
||||
assertNull(authenticationComponent.getCurrentAuthentication());
|
||||
|
||||
|
||||
|
||||
pubAuthenticationService.authenticateAsGuest();
|
||||
authenticationComponent.clearCurrentSecurityContext();
|
||||
assertNull(authenticationComponent.getCurrentAuthentication());
|
||||
|
||||
|
||||
// create an authentication object e.g. the user
|
||||
|
||||
|
@ -96,7 +96,10 @@ public class SimpleAuthorityServiceImpl implements AuthorityService
|
||||
{
|
||||
authorities.addAll(adminSet);
|
||||
}
|
||||
if(AuthorityType.getAuthorityType(currentUserName) != AuthorityType.GUEST)
|
||||
{
|
||||
authorities.addAll(allSet);
|
||||
}
|
||||
return authorities;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user