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


Java AuthException类代码示例

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


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

示例1: setPermissions

import us.kbase.auth.AuthException; //导入依赖的package包/类
private long setPermissions(
		final SetPermissionsParams params,
		final WorkspaceUser user,
		final boolean asAdmin,
		final AuthToken token)
		throws IOException, AuthException, CorruptWorkspaceDBException,
			NoSuchWorkspaceException, WorkspaceAuthorizationException,
			WorkspaceCommunicationException {
	checkAddlArgs(params.getAdditionalProperties(), params.getClass());
	final WorkspaceIdentifier wsi = processWorkspaceIdentifier(
			params.getWorkspace(), params.getId());
	final Permission p = translatePermission(params.getNewPermission());
	if (params.getUsers().size() == 0) {
		throw new IllegalArgumentException("Must provide at least one user");
	}
	final List<WorkspaceUser> users = validateUsers(params.getUsers(), token);
	return ws.setPermissions(user, wsi, users, p, asAdmin);
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:19,代码来源:WorkspaceServerMethods.java

示例2: validateUsers

import us.kbase.auth.AuthException; //导入依赖的package包/类
public List<WorkspaceUser> validateUsers(final List<String> users, final AuthToken token)
		throws IOException, AuthException {
	final List<WorkspaceUser> wsusers = convertUsers(users);
	final Map<String, Boolean> userok;
	try {
		userok = auth.isValidUserName(users, token);
	} catch (UnknownHostException uhe) {
		//message from UHE is only the host name
		throw new AuthException(
				"Could not contact Authorization Service host to validate user names: "
						+ uhe.getMessage(), uhe);
	}
	for (String u: userok.keySet()) {
		if (!userok.get(u)) {
			throw new IllegalArgumentException(String.format(
					"User %s is not a valid user", u));
		}
	}
	return wsusers;
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:21,代码来源:WorkspaceServerMethods.java

示例3: reportAweStatus

import us.kbase.auth.AuthException; //导入依赖的package包/类
protected static void reportAweStatus(AuthToken authPart, String returnVal,
		String result) throws IOException, JsonProcessingException,
		MalformedURLException, JsonClientException,
		JsonParseException, JsonMappingException, ServerException, AuthException {
	System.out.println(result);
	JsonNode rootNode = new ObjectMapper().registerModule(new JacksonTupleModule()).readTree(result);
	String aweId = "";
	if (rootNode.has("data")){
		JsonNode dataNode = rootNode.get("data");
		if (dataNode.has("id")){
			aweId = CmonkeyServerConfig.AWE_SERVICE_URL + "/" + dataNode.get("id").textValue();
			System.out.println(aweId);
			updateJobProgress(returnVal, "AWE job submitted: " + aweId, 1L, authPart.toString());
		}
	}
	if (rootNode.has("error")){
		if (rootNode.get("error").textValue()!=null){
			System.out.println(rootNode.get("error").textValue());
			updateJobProgress(returnVal, "AWE reported error on job " + aweId, 1L, authPart.toString());
			throw new ServerException(rootNode.get("error").textValue(), 0, "Unknown", null);
		}
	}
}
 
开发者ID:kbase,项目名称:cmonkey,代码行数:24,代码来源:CmonkeyServerCaller.java

示例4: validateToken

import us.kbase.auth.AuthException; //导入依赖的package包/类
@Override
protected AuthToken validateToken(String tokenString) throws AuthException,
        IOException {
    String origTokenString = token.getToken();
    if (tokenString.equals(origTokenString)) {
        return token;
    }
    return new AuthToken(tokenString, "<unknown>");
}
 
开发者ID:kbase,项目名称:kb_sdk,代码行数:10,代码来源:CallbackServer.java

示例5: getUser

import us.kbase.auth.AuthException; //导入依赖的package包/类
private WorkspaceUser getUser(final String user, final AuthToken token)
		throws IOException, AuthException {
	if (user == null) {
		throw new NullPointerException("User may not be null");
	}
	return wsmeth.validateUsers(Arrays.asList(user), token).get(0);
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:8,代码来源:WorkspaceAdministration.java

示例6: getNullableUser

import us.kbase.auth.AuthException; //导入依赖的package包/类
private WorkspaceUser getNullableUser(final AdminCommand cmd, final AuthToken token)
		throws IOException, AuthException {
	if (cmd.getUser() == null) {
		return null;
	}
	return wsmeth.validateUsers(Arrays.asList(cmd.getUser()), token).get(0);
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:8,代码来源:WorkspaceAdministration.java

示例7: getUser

import us.kbase.auth.AuthException; //导入依赖的package包/类
public WorkspaceUser getUser(
		final String tokenstring,
		final AuthToken token)
		throws IOException, AuthException {
	if (tokenstring != null) {
		final AuthToken t = auth.validateToken(tokenstring);
		return new WorkspaceUser(t.getUserName());
	}
	if (token == null) {
		return null;
	}
	return new WorkspaceUser(token.getUserName());
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:14,代码来源:WorkspaceServerMethods.java

示例8: setPermissionsAsAdmin

import us.kbase.auth.AuthException; //导入依赖的package包/类
/** Set permissions on a workspace as an admin.
 * @param params the parameters for the set permissions call.
 * @param token a token to use for user lookup in the authentication service.
 * @return the ID of the workspace.
 * @throws IOException if an error occurs when contacting the authentication service.
 * @throws AuthException if the authentication service could not be contacted.
 * @throws CorruptWorkspaceDBException if corrupt data is found in the data stores.
 * @throws NoSuchWorkspaceException if the specified workspace does not exist.
 * @throws WorkspaceCommunicationException if a communication error occurs when contacting
 * the data stores.
 */
public long setPermissionsAsAdmin(
		final SetPermissionsParams params,
		final AuthToken token)
		throws IOException, AuthException, CorruptWorkspaceDBException,
			NoSuchWorkspaceException, WorkspaceCommunicationException {
	try {
		return setPermissions(params, null, true, token);
	} catch (WorkspaceAuthorizationException e) {
		throw new RuntimeException("This shouldn't happen", e);
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:23,代码来源:WorkspaceServerMethods.java

示例9: getToken

import us.kbase.auth.AuthException; //导入依赖的package包/类
public static AuthToken getToken(
		final int user,
		final ConfigurableAuthService auth) {
	try {
		return auth.validateToken(getToken(user));
	} catch (AuthException | IOException e) {
		throw new TestException(String.format(
				"Couldn't log in user #%s with token : %s", user, e.getMessage()), e);
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:11,代码来源:TestCommon.java

示例10: requestTokenFromKBase

import us.kbase.auth.AuthException; //导入依赖的package包/类
public static AuthToken requestTokenFromKBase(String user, char[] password)
		throws UnauthorizedException, IOException {
	try {
		return AuthService.login(user, new String(password)).getToken();
	} catch (AuthException ex) {
		throw new UnauthorizedException("Could not authenticate user", ex);
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:9,代码来源:JsonClientCaller.java

示例11: updateJobProgress

import us.kbase.auth.AuthException; //导入依赖的package包/类
protected static void updateJobProgress(String jobId, String status,
		Long tasks, String token) throws MalformedURLException, IOException, JsonClientException, AuthException {
	Date date = new Date();
	date.setTime(date.getTime() + 10000L);
	UserAndJobStateClient jobClient = new UserAndJobStateClient(new URL(
			CmonkeyServerConfig.JOB_SERVICE_URL), new AuthToken(token));
	// jobClient.setAuthAllowedForHttp(true);
	jobClient.updateJobProgress(jobId, AuthService.login(CmonkeyServerConfig.SERVICE_LOGIN, new String(CmonkeyServerConfig.SERVICE_PASSWORD)).getToken().toString(), status, tasks,
			dateFormat.format(date));
	jobClient = null;
}
 
开发者ID:kbase,项目名称:cmonkey,代码行数:12,代码来源:CmonkeyServerCaller.java

示例12: startJob

import us.kbase.auth.AuthException; //导入依赖的package包/类
protected static void startJob(String jobId, String desc, Long tasks,
		String token) throws UnauthorizedException, IOException,
		JsonClientException, AuthException {

	String status = "cmonkey service job started. Preparing input...";
	InitProgress initProgress = new InitProgress();
	initProgress.setPtype("task");
	initProgress.setMax(tasks);
	Date date = new Date();
	date.setTime(date.getTime() + 10080000L);
	URL jobServiceUrl = new URL(CmonkeyServerConfig.JOB_SERVICE_URL);
	UserAndJobStateClient jobClient = new UserAndJobStateClient(jobServiceUrl, new AuthToken(token));
	jobClient.startJob(jobId, AuthService.login(CmonkeyServerConfig.SERVICE_LOGIN, new String(CmonkeyServerConfig.SERVICE_PASSWORD)).getToken().toString(), status, desc, initProgress,
			dateFormat.format(date));
}
 
开发者ID:kbase,项目名称:cmonkey,代码行数:16,代码来源:CmonkeyServerImpl.java

示例13: updateJobProgress

import us.kbase.auth.AuthException; //导入依赖的package包/类
protected static void updateJobProgress(String jobId, String status,
		String token) throws UnauthorizedException, IOException,
		JsonClientException, AuthException {
	Date date = new Date();
	date.setTime(date.getTime() + 1000000L);
	URL jobServiceUrl = new URL(CmonkeyServerConfig.JOB_SERVICE_URL);
	UserAndJobStateClient jobClient = new UserAndJobStateClient(jobServiceUrl, new AuthToken(token));
	jobClient.updateJobProgress(jobId, AuthService.login(CmonkeyServerConfig.SERVICE_LOGIN, new String(CmonkeyServerConfig.SERVICE_PASSWORD)).getToken().toString(), status, 1L,
			dateFormat.format(date));
}
 
开发者ID:kbase,项目名称:cmonkey,代码行数:11,代码来源:CmonkeyServerImpl.java

示例14: getJobStatus

import us.kbase.auth.AuthException; //导入依赖的package包/类
protected static String getJobStatus(String jobId,
		String token) throws UnauthorizedException, IOException,
		JsonClientException, AuthException {
	URL jobServiceUrl = new URL(CmonkeyServerConfig.JOB_SERVICE_URL);
	UserAndJobStateClient jobClient = new UserAndJobStateClient(jobServiceUrl, new AuthToken(token));
	String retVal = jobClient.getJobStatus(jobId).getE3();
	return retVal;
}
 
开发者ID:kbase,项目名称:cmonkey,代码行数:9,代码来源:CmonkeyServerImpl.java

示例15: finishJob

import us.kbase.auth.AuthException; //导入依赖的package包/类
protected static void finishJob(String jobId, String wsId, String objectId,
		String status, String token) throws UnauthorizedException,
		IOException, JsonClientException, AuthException {
	String error = null;
	Results res = new Results();
	List<String> workspaceIds = new ArrayList<String>();
	workspaceIds.add(wsId + "/" + objectId);
	res.setWorkspaceids(workspaceIds);
	URL jobServiceUrl = new URL(CmonkeyServerConfig.JOB_SERVICE_URL);
	UserAndJobStateClient jobClient = new UserAndJobStateClient(jobServiceUrl, new AuthToken(token));
	jobClient.completeJob(jobId, AuthService.login(CmonkeyServerConfig.SERVICE_LOGIN, new String(CmonkeyServerConfig.SERVICE_PASSWORD)).getToken().toString(), status, error, res);
}
 
开发者ID:kbase,项目名称:cmonkey,代码行数:13,代码来源:CmonkeyServerImpl.java


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