final String serviceTicketId = MoriaController.attemptSingleSignOn(newLoginTicketId, ssoTicketId); final Map actualAttrs = MoriaController.getUserAttributes(serviceTicketId, validPrincipal);  validateMaps(expectedAttrs, actualAttrs);
try { final String serviceTicketId = MoriaController.attemptSingleSignOn(newLoginTicketId, ssoTicketId); final Map actualAttrs = MoriaController.getUserAttributes(serviceTicketId, validPrincipal); validateMaps(expectedAttrs, actualAttrs); } catch (UnknownServicePrincipalException failure) { fail("UnknownServicePrincipalException should not be caught"); }
    public void testAttemptSingleSignOn() throws MoriaControllerException {        /* Check controller initialization */        controllerInitialization();        boolean denySSO = false;        /* Invalid arguments */        try {            MoriaController.attemptSingleSignOn(null, "foo");            fail("IllegalInputException should be raised, loginTicketId is null.");        } catch (IllegalInputException success) {        }        try {            MoriaController.attemptSingleSignOn("", "foo");            fail("IllegalInputException should be raised, loginTicketId is an empty string.");        } catch (IllegalInputException success) {        }        try {            MoriaController.attemptSingleSignOn("foo", null);            fail("IllegalInputException should be raised, ssoTicketId is null.");        } catch (IllegalInputException success) {        }        try {            MoriaController.attemptSingleSignOn("foo", "");            fail("IllegalInputException should be raised, ssoTicketId is an empty string.");        } catch (IllegalInputException success) {        }        /* Invalid loginTicket */        try {            MoriaController.attemptSingleSignOn("doesNotExist", "foo");            fail("UnknownTicketException should be raised, non-existing loginTicketId");        } catch (UnknownTicketException success) {        }        /* Invalid ssoTicket */        String loginTicketId = MoriaController.initiateAuthentication(validAttrs, validPrefix, validPostfix, false,                                                                      validPrincipal);        try {            MoriaController.attemptSingleSignOn(loginTicketId, "doesNotExist");            fail("UnknownTicketException should be raised, non-existing ssoTicketId");        } catch (UnknownTicketException success) {        }        /* Force authentication */          loginTicketId = MoriaController.initiateAuthentication(validAttrs, validPrefix, validPostfix, false,                                                                        validPrincipal);        Map tickets = MoriaController.attemptLogin(loginTicketId, null, validUsername, validPassword, denySSO);        String ssoTicketId = (String) tickets.get(MoriaController.SSO_TICKET);        String newLoginTicketId = MoriaController.initiateAuthentication(validAttrs, validPrefix, validPostfix, true,                                                                         validPrincipal);        try {            MoriaController.attemptSingleSignOn(newLoginTicketId, ssoTicketId);            fail("UnknownTicketException should be raised, authentication attempt requires interactive authentication.");        } catch (UnknownTicketException success) {        }        /* userorg */        loginTicketId = MoriaController.initiateAuthentication(validAttrs, validPrefix, validPostfix, false, validPrincipal);        tickets = MoriaController.attemptLogin(loginTicketId, null, validUsername, validPassword, denySSO);        ssoTicketId = (String) tickets.get(MoriaController.SSO_TICKET);        newLoginTicketId = MoriaController.initiateAuthentication(validAttrs, validPrefix, validPostfix, false, "limited");        try {            final String serviceTicketId = MoriaController.attemptSingleSignOn(newLoginTicketId, ssoTicketId);            final Map actualAttrs = MoriaController.getUserAttributes(serviceTicketId, "limited");            fail("AuthorizationException should be raised. Userorg not allowed.");        } catch (AuthorizationException success) {                    }              /* Normal use */        loginTicketId = MoriaController.initiateAuthentication(validAttrs, validPrefix, validPostfix, false,                                                                        validPrincipal);        tickets = MoriaController.attemptLogin(loginTicketId, null, validUsername, validPassword, denySSO);        ssoTicketId = (String) tickets.get(MoriaController.SSO_TICKET);        newLoginTicketId = MoriaController.initiateAuthentication(validAttrs, validPrefix, validPostfix, false,                                                                         validPrincipal);        final String serviceTicketId = MoriaController.attemptSingleSignOn(newLoginTicketId, ssoTicketId);        final Map actualAttrs = MoriaController.getUserAttributes(serviceTicketId, validPrincipal);        validateMaps(expectedAttrs, actualAttrs);    }