private void testTimeout() { String[] roles = {"*"}; securityProvider.setSessionTimeout(500L); String token; try { token = securityProvider.autheticate("admin", "NCB", roles); } catch (UserNotAutenticatedException e) { fail(); return; } try { Thread.sleep(800); } catch (InterruptedException e) { fail(); return; } try { securityProvider.checkSecurityToken("admin", token, "*"); } catch (SessionTimedOutException e) { return; } catch (UserNotAutenticatedException e) { fail(); } fail(); }
private void testBadToken() { try { securityProvider.checkSecurityToken("admin", "badt token", "*"); } catch (Exception e) { return; // passed; } fail(); }
private void testGoodLogin() { String[] roles = {"*"}; try { securityProvider.autheticate("admin", "NCB", roles); } catch (UserNotAutenticatedException e) { fail(); } }
private void testBaddUserName() { String[] roles = {"*"}; try { securityProvider.autheticate("admn", "NCB", roles); } catch (UserNotAutenticatedException e) { return; // passed } fail(); }
private void testBadUser() { String[] roles = {"*"}; String token; try { token = securityProvider.autheticate("admin", "NCB", roles); } catch (UserNotAutenticatedException e) { fail(); return; } try { securityProvider.checkSecurityToken("admn", token, "*"); } catch (UserNotAutenticatedException e) { return; // test passed } catch (SessionTimedOutException e) { fail(); } fail(); }