@Test public void testGuestLogin() throws Exception { try (ContentSession cs = login(new GuestCredentials())) { fail("GuestCredentials login should fail"); } catch (LoginException e) { } }
@Override public boolean login() throws LoginException { tokenProvider = getTokenProvider(); if (tokenProvider == null) { return false; } Credentials credentials = getCredentials(); if (credentials instanceof TokenCredentials) { TokenCredentials tc = (TokenCredentials) credentials; TokenAuthentication authentication = new TokenAuthentication(tokenProvider); if (authentication.authenticate(tc)) { tokenCredentials = tc; tokenInfo = authentication.getTokenInfo(); principal = authentication.getUserPrincipal(); log.debug("Login: adding login name to shared state."); sharedState.put(SHARED_KEY_LOGIN_NAME, tokenInfo.getUserId()); return true; } } return false; }
TokenLoginModule extends AbstractLoginModule { @Override public boolean login() throws LoginException { tokenProvider = getTokenProvider(); if (tokenProvider == null) { return false; } Credentials credentials = getCredentials(); if (credentials instanceof TokenCredentials) { TokenCredentials tc = (TokenCredentials) credentials; TokenAuthentication authentication = new TokenAuthentication(tokenProvider); if (authentication.authenticate(tc)) { tokenCredentials = tc; tokenInfo = authentication.getTokenInfo(); principal = authentication.getUserPrincipal(); log.debug("Login: adding login name to shared state."); sharedState.put(SHARED_KEY_LOGIN_NAME, tokenInfo.getUserId()); return true; } } return false; } }
TokenLoginModule extends AbstractLoginModule { @Override public boolean login() throws LoginException { tokenProvider = getTokenProvider(); if (tokenProvider == null) { return false; } Credentials credentials = getCredentials(); if (credentials instanceof TokenCredentials) { TokenCredentials tc = (TokenCredentials) credentials; TokenAuthentication authentication = new TokenAuthentication(tokenProvider); if (authentication.authenticate(tc)) { tokenCredentials = tc; tokenInfo = authentication.getTokenInfo(); principal = authentication.getUserPrincipal(); log.debug("Login: adding login name to shared state."); sharedState.put(SHARED_KEY_LOGIN_NAME, tokenInfo.getUserId()); return true; } } return false; }  }
TokenLoginModule extends AbstractLoginModule { @Override public boolean login() throws LoginException { tokenProvider = getTokenProvider(); if (tokenProvider == null) { return false; } Credentials credentials = getCredentials(); if (credentials instanceof TokenCredentials) { TokenCredentials tc = (TokenCredentials) credentials; TokenAuthentication authentication = new TokenAuthentication(tokenProvider); if (authentication.authenticate(tc)) { tokenCredentials = tc; tokenInfo = authentication.getTokenInfo(); principal = authentication.getUserPrincipal(); log.debug("Login: adding login name to shared state."); sharedState.put(SHARED_KEY_LOGIN_NAME, tokenInfo.getUserId()); return true; } } return false; }  @Override boolean login(); @Override boolean commit(); @Override boolean logout(); }
TokenLoginModule extends AbstractLoginModule { @Override public boolean login() throws LoginException { tokenProvider = getTokenProvider(); if (tokenProvider == null) { return false; } Credentials credentials = getCredentials(); if (credentials instanceof TokenCredentials) { TokenCredentials tc = (TokenCredentials) credentials; TokenAuthentication authentication = new TokenAuthentication(tokenProvider); if (authentication.authenticate(tc)) { tokenCredentials = tc; tokenInfo = authentication.getTokenInfo(); principal = authentication.getUserPrincipal(); log.debug("Login: adding login name to shared state."); sharedState.put(SHARED_KEY_LOGIN_NAME, tokenInfo.getUserId()); return true; } } return false; }  @Override boolean login(); @Override boolean commit(); @Override boolean logout();  }