@Override public NewCookie[] getCookies(String username, String password, boolean remember) throws EncryptionException { AccountsSettings accountsSettings = configurationService.getSettings(AccountsSettings.class); int ageWhenRemember = 60 * (context.getRequest().isApiRequest() ? accountsSettings.getApiSessionDuration().getValue() : accountsSettings.getWebSessionDuration().getValue()); NewCookie newUserCookie = new NewCookie("username", crypter.encrypt(username), "/", null, null, remember ? ageWhenRemember : -1, false); NewCookie newPassCookie = new NewCookie("password", crypter.encrypt(password), "/", null, null, remember ? ageWhenRemember : -1, false); return new NewCookie[]{ newUserCookie, newPassCookie }; } }