From e1ec2cbf943b8eb4b4619c7e8259190ab8387d91 Mon Sep 17 00:00:00 2001 From: brinn <brinn> Date: Thu, 22 Jul 2010 21:08:14 +0000 Subject: [PATCH] change: replace deprecated methods in the authentication service SVN: 17165 --- .../openbis/generic/server/AbstractCommonServer.java | 9 +-------- .../cisd/openbis/generic/server/CommonServerTest.java | 7 +------ .../openbis/generic/shared/AbstractServerTestCase.java | 7 +------ 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/AbstractCommonServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/AbstractCommonServer.java index 50c67a19d50..ecd022ecf33 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/AbstractCommonServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/AbstractCommonServer.java @@ -24,7 +24,6 @@ import org.apache.commons.lang.StringUtils; import ch.systemsx.cisd.authentication.IAuthenticationService; import ch.systemsx.cisd.authentication.ISessionManager; import ch.systemsx.cisd.authentication.Principal; -import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException; import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.openbis.generic.server.business.bo.ICommonBusinessObjectFactory; import ch.systemsx.cisd.openbis.generic.server.business.bo.IExternalDataTable; @@ -63,11 +62,6 @@ abstract class AbstractCommonServer<T extends IServer> extends AbstractServer<T> throw UserFailureException.fromTemplate("Following persons already exist: [%s]", StringUtils.join(userIDs, ",")); } - final String applicationToken = authenticationService.authenticateApplication(); - if (applicationToken == null) - { - throw new EnvironmentFailureException("Authentication service cannot be accessed."); - } List<String> unknownUsers = new ArrayList<String>(); final DisplaySettings defaultDisplaySettings = getDefaultDisplaySettings(sessionToken); List<PersonPE> newPersons = new ArrayList<PersonPE>(); @@ -75,8 +69,7 @@ abstract class AbstractCommonServer<T extends IServer> extends AbstractServer<T> { try { - final Principal principal = - authenticationService.getPrincipal(applicationToken, userID); + final Principal principal = authenticationService.getPrincipal(userID); newPersons.add(createPerson(principal, session.tryGetPerson(), defaultDisplaySettings)); } catch (final IllegalArgumentException e) diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/CommonServerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/CommonServerTest.java index 6fd861701c2..ed836d4ebe3 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/CommonServerTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/CommonServerTest.java @@ -445,16 +445,11 @@ public final class CommonServerTest extends AbstractServerTestCase one(personDAO).listByCodes(Arrays.asList(CommonTestUtils.USER_ID)); will(returnValue(new ArrayList<PersonPE>())); - final String applicationToken = "application-token"; - one(authenticationService).authenticateApplication(); - will(returnValue(applicationToken)); - final PersonPE systemPerson = createSystemUser(); one(personDAO).tryFindPersonByUserId(PersonPE.SYSTEM_USER_ID); will(returnValue(systemPerson)); - one(authenticationService).getPrincipal(applicationToken, - CommonTestUtils.USER_ID); + one(authenticationService).getPrincipal(CommonTestUtils.USER_ID); will(throwException(new IllegalArgumentException())); } }); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/AbstractServerTestCase.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/AbstractServerTestCase.java index e47675acdc9..2ce8d421f6f 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/AbstractServerTestCase.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/AbstractServerTestCase.java @@ -285,16 +285,11 @@ public abstract class AbstractServerTestCase extends AssertJUnit one(personDAO).listByCodes(Arrays.asList(CommonTestUtils.USER_ID)); will(returnValue(new ArrayList<PersonPE>())); - final String applicationToken = "application-token"; - one(authenticationService).authenticateApplication(); - will(returnValue(applicationToken)); - final PersonPE systemPerson = createSystemUser(); one(personDAO).tryFindPersonByUserId(PersonPE.SYSTEM_USER_ID); will(returnValue(systemPerson)); - one(authenticationService).getPrincipal(applicationToken, - CommonTestUtils.USER_ID); + one(authenticationService).getPrincipal(CommonTestUtils.USER_ID); will(returnValue(PRINCIPAL)); final PersonPE person = CommonTestUtils.createPersonFromPrincipal(PRINCIPAL); -- GitLab