当前位置: 首页>>代码示例>>Java>>正文


Java UserManagerException类代码示例

本文整理汇总了Java中azkaban.user.UserManagerException的典型用法代码示例。如果您正苦于以下问题:Java UserManagerException类的具体用法?Java UserManagerException怎么用?Java UserManagerException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UserManagerException类属于azkaban.user包,在下文中一共展示了UserManagerException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: login

import azkaban.user.UserManagerException; //导入依赖的package包/类
@Action(name = "login")
public String login(@ActionParam("username") String username,
    @ActionParam("password") String password) throws UserManagerException,
    ServletException {
  String ip =
      (String) this.getContext().getRawRequestContext()
          .getLocalAttr("REMOTE_ADDR");
  logger
      .info("Attempting to login for " + username + " from ip '" + ip + "'");

  Session session = createSession(username, password, ip);

  logger.info("Session id " + session.getSessionId() + " created for user '"
      + username + "' and ip " + ip);
  return session.getSessionId();
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:17,代码来源:UserManagerResource.java

示例2: handleAjaxLoginAction

import azkaban.user.UserManagerException; //导入依赖的package包/类
protected void handleAjaxLoginAction(HttpServletRequest req, HttpServletResponse resp, Map<String, Object> ret) throws ServletException {
	if (hasParam(req, "username") && hasParam(req, "password")) {
		Session session = null;
		try {
			session = createSession(req);
		} catch (UserManagerException e) {
			ret.put("error", "Incorrect Login. " + e.getMessage());
			return;
		}
		
		Cookie cookie = new Cookie(SESSION_ID_NAME, session.getSessionId());
		cookie.setPath("/");
		resp.addCookie(cookie);
		getApplication().getSessionCache().addSession(session);
		ret.put("status", "success");
		ret.put("session.id", session.getSessionId());
	} 
	else {
		ret.put("error", "Incorrect Login.");
	}
}
 
开发者ID:zhizhounq,项目名称:azkaban-customization,代码行数:22,代码来源:LoginAbstractAzkabanServlet.java

示例3: testInvalidIdPropertyThrowsUserManagerException

import azkaban.user.UserManagerException; //导入依赖的package包/类
@Test
public void testInvalidIdPropertyThrowsUserManagerException() throws Exception {
    thrown.expect(UserManagerException.class);

    Props props = getProps();
    props.put(LdapUserManager.LDAP_USERID_PROPERTY, "invalidField");
    userManager = new LdapUserManager(props);
    userManager.getUser("gauss", "password");
}
 
开发者ID:Codefor,项目名称:azkaban-ldap-usermanager,代码行数:10,代码来源:LdapUserManagerTest.java

示例4: getUserFromSessionId

import azkaban.user.UserManagerException; //导入依赖的package包/类
public static User getUserFromSessionId(String sessionId, String ip)
    throws UserManagerException {
  Session session =
      AzkabanWebServer.getInstance().getSessionCache().getSession(sessionId);
  if (session == null) {
    throw new UserManagerException("Invalid session. Login required");
  } else if (!session.getIp().equals(ip)) {
    throw new UserManagerException("Invalid session. Session expired.");
  }

  return session.getUser();
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:13,代码来源:ResourceUtils.java

示例5: createSession

import azkaban.user.UserManagerException; //导入依赖的package包/类
private Session createSession(String username, String password, String ip)
    throws UserManagerException, ServletException {
  UserManager manager = getAzkaban().getUserManager();
  azkaban.user.User user = manager.getUser(username, password);

  String randomUID = UUID.randomUUID().toString();
  Session session = new Session(randomUID, user, ip);
  getAzkaban().getSessionCache().addSession(session);

  return session;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:12,代码来源:UserManagerResource.java

示例6: TestFilterNonAdminOnlyFlowParams

import azkaban.user.UserManagerException; //导入依赖的package包/类
@Test
public void TestFilterNonAdminOnlyFlowParams() throws IOException,
  ExecutorManagerException, UserManagerException {
  ExecutableFlow flow = createExecutableFlow();
  UserManager manager = TestUtils.createTestXmlUserManager();
  User user = manager.getUser("testUser", "testUser");

  HttpRequestUtils.filterAdminOnlyFlowParams(manager,
    flow.getExecutionOptions(), user);

  Assert.assertFalse(flow.getExecutionOptions().getFlowParameters()
    .containsKey(ExecutionOptions.FLOW_PRIORITY));
  Assert.assertFalse(flow.getExecutionOptions().getFlowParameters()
    .containsKey(ExecutionOptions.USE_EXECUTOR));
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:16,代码来源:HttpRequestUtilsTest.java

示例7: TestFilterAdminOnlyFlowParams

import azkaban.user.UserManagerException; //导入依赖的package包/类
@Test
public void TestFilterAdminOnlyFlowParams() throws IOException,
  ExecutorManagerException, UserManagerException {
  ExecutableFlow flow = createExecutableFlow();
  UserManager manager = TestUtils.createTestXmlUserManager();
  User user = manager.getUser("testAdmin", "testAdmin");

  HttpRequestUtils.filterAdminOnlyFlowParams(manager,
    flow.getExecutionOptions(), user);

  Assert.assertTrue(flow.getExecutionOptions().getFlowParameters()
    .containsKey(ExecutionOptions.FLOW_PRIORITY));
  Assert.assertTrue(flow.getExecutionOptions().getFlowParameters()
    .containsKey(ExecutionOptions.USE_EXECUTOR));
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:16,代码来源:HttpRequestUtilsTest.java

示例8: testHasAdminPermission

import azkaban.user.UserManagerException; //导入依赖的package包/类
@Test
public void testHasAdminPermission() throws UserManagerException {
  UserManager manager = TestUtils.createTestXmlUserManager();
  User adminUser = manager.getUser("testAdmin", "testAdmin");
  Assert.assertTrue(HttpRequestUtils.hasPermission(manager, adminUser,
    Type.ADMIN));
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:8,代码来源:HttpRequestUtilsTest.java

示例9: testHasOrdinaryPermission

import azkaban.user.UserManagerException; //导入依赖的package包/类
@Test
public void testHasOrdinaryPermission() throws UserManagerException {
  UserManager manager = TestUtils.createTestXmlUserManager();
  User testUser = manager.getUser("testUser", "testUser");
  Assert.assertFalse(HttpRequestUtils.hasPermission(manager, testUser,
    Type.ADMIN));
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:8,代码来源:HttpRequestUtilsTest.java

示例10: createSession

import azkaban.user.UserManagerException; //导入依赖的package包/类
private Session createSession(HttpServletRequest req) throws UserManagerException, ServletException {
	String username = getParam(req, "username");
	String password = getParam(req, "password");
	String ip = req.getRemoteAddr();
	
	return createSession(username, password, ip);
}
 
开发者ID:zhizhounq,项目名称:azkaban-customization,代码行数:8,代码来源:LoginAbstractAzkabanServlet.java

示例11: testGetUserWithInvalidPasswordThrowsUserManagerException

import azkaban.user.UserManagerException; //导入依赖的package包/类
@Test
public void testGetUserWithInvalidPasswordThrowsUserManagerException() throws Exception {
    thrown.expect(UserManagerException.class);
    userManager.getUser("gauss", "invalid");
}
 
开发者ID:Codefor,项目名称:azkaban-ldap-usermanager,代码行数:6,代码来源:LdapUserManagerTest.java

示例12: testGetUserWithInvalidUsernameThrowsUserManagerException

import azkaban.user.UserManagerException; //导入依赖的package包/类
@Test
public void testGetUserWithInvalidUsernameThrowsUserManagerException() throws Exception {
    thrown.expect(UserManagerException.class);
    userManager.getUser("invalid", "password");
}
 
开发者ID:Codefor,项目名称:azkaban-ldap-usermanager,代码行数:6,代码来源:LdapUserManagerTest.java

示例13: testGetUserWithEmptyPasswordThrowsUserManagerException

import azkaban.user.UserManagerException; //导入依赖的package包/类
@Test
public void testGetUserWithEmptyPasswordThrowsUserManagerException() throws Exception {
    thrown.expect(UserManagerException.class);
    userManager.getUser("gauss", "");
}
 
开发者ID:Codefor,项目名称:azkaban-ldap-usermanager,代码行数:6,代码来源:LdapUserManagerTest.java

示例14: testGetUserWithEmptyUsernameThrowsUserManagerException

import azkaban.user.UserManagerException; //导入依赖的package包/类
@Test
public void testGetUserWithEmptyUsernameThrowsUserManagerException() throws Exception {
    thrown.expect(UserManagerException.class);
    userManager.getUser("", "invalid");
}
 
开发者ID:Codefor,项目名称:azkaban-ldap-usermanager,代码行数:6,代码来源:LdapUserManagerTest.java

示例15: createSession

import azkaban.user.UserManagerException; //导入依赖的package包/类
/**
 * 创建session对象
 *
 * @param sessionid
 * @param username
 * @param password
 * @param ip
 * @return
 * @throws UserManagerException
 * @throws ServletException
 */
private Session createSession(String sessionid, String username, String password, String ip)
        throws UserManagerException, ServletException {
    User user = userManager.getUser(username, password);
    Session session = new Session(sessionid, user, ip);
    return session;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:18,代码来源:SessionCodis.java


注:本文中的azkaban.user.UserManagerException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。