本文整理汇总了Java中org.osiam.client.exception.ForbiddenException类的典型用法代码示例。如果您正苦于以下问题:Java ForbiddenException类的具体用法?Java ForbiddenException怎么用?Java ForbiddenException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ForbiddenException类属于org.osiam.client.exception包,在下文中一共展示了ForbiddenException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.osiam.client.exception.ForbiddenException; //导入依赖的package包/类
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
try {
jobName = context.getJobDetail().getKey().getName();
osiamConnector = OsiamContext.getInstance().getConnector(jobName);
accessToken = OsiamContext.getInstance().getValidAccessToken();
int i = (int) (Math.random() * 30 + 1);
if (i > 0 && i <= 10) {
createNewUser();
} else if (i > 10 && i <= 18) {
searchUser();
} else if (i > 18 && i <= 26) {
getUser();
} else if (i > 26 && i <= 28) {
updateUser();
} else if (i > 28 && i <= 29) {
replaceUser();
} else if (i == 30) {
deleteUser();
}
} catch (ConflictException | NoResultException | ForbiddenException ex) {
logError(ex);
} catch (Throwable e) {
logError(e);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
logger.error(jobName + ": " + sw.toString());
}
}
示例2: cannot_search_for_own_user
import org.osiam.client.exception.ForbiddenException; //导入依赖的package包/类
@Test(expected = ForbiddenException.class)
public void cannot_search_for_own_user() {
AccessToken accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ME);
Query query = new QueryBuilder().filter("userName eq \"marissa\"").build();
OSIAM_CONNECTOR.searchUsers(query, accessToken);
}
示例3: cannot_search_for_any_users
import org.osiam.client.exception.ForbiddenException; //导入依赖的package包/类
@Test(expected = ForbiddenException.class)
public void cannot_search_for_any_users() {
AccessToken accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ME);
Query query = new QueryBuilder()
.filter("meta.created gt \"2010-10-10T00:00:00.000\"")
.build();
OSIAM_CONNECTOR.searchUsers(query, accessToken);
}
示例4: cannot_create_user
import org.osiam.client.exception.ForbiddenException; //导入依赖的package包/类
@Test(expected = ForbiddenException.class)
public void cannot_create_user() {
AccessToken accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ME);
User user = new User.Builder("newUser").build();
OSIAM_CONNECTOR.createUser(user, accessToken);
}
示例5: cannot_replace_other_user
import org.osiam.client.exception.ForbiddenException; //导入依赖的package包/类
@Test(expected = ForbiddenException.class)
public void cannot_replace_other_user() {
AccessToken accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ME);
User originalUser = OSIAM_CONNECTOR.getUser(OWN_USER_ID, accessToken);
Email email = new Email.Builder()
.setValue("[email protected]")
.setType(Email.Type.HOME)
.build();
User replaceUser = new User.Builder(originalUser)
.setDisplayName("Marissa")
.addEmail(email)
.build();
OSIAM_CONNECTOR.replaceUser(OTHER_USER_ID, replaceUser, accessToken);
}
示例6: cannot_create_group
import org.osiam.client.exception.ForbiddenException; //导入依赖的package包/类
@Test(expected = ForbiddenException.class)
public void cannot_create_group() {
AccessToken accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ME);
MemberRef memberRef = new MemberRef.Builder()
.setValue(OWN_USER_ID)
.setType(MemberRef.Type.USER)
.build();
Group group = new Group.Builder("newGroup")
.setMembers(Collections.singleton(memberRef))
.build();
OSIAM_CONNECTOR.createGroup(group, accessToken);
}
示例7: cannot_replace_group
import org.osiam.client.exception.ForbiddenException; //导入依赖的package包/类
@Test(expected = ForbiddenException.class)
public void cannot_replace_group() {
AccessToken accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ME);
MemberRef memberRef = new MemberRef.Builder()
.setValue(OWN_USER_ID)
.setType(MemberRef.Type.USER)
.build();
Group group = new Group.Builder("test_group01")
.setMembers(Collections.singleton(memberRef))
.build();
OSIAM_CONNECTOR.replaceGroup(GROUP_ID, group, accessToken);
}
示例8: cannot_search_for_groups
import org.osiam.client.exception.ForbiddenException; //导入依赖的package包/类
@Test(expected = ForbiddenException.class)
public void cannot_search_for_groups() {
AccessToken accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ME);
Query query = new QueryBuilder().filter("displayName eq \"test_group01\"").build();
OSIAM_CONNECTOR.searchGroups(query, accessToken);
}
示例9: cannot_get_all_users
import org.osiam.client.exception.ForbiddenException; //导入依赖的package包/类
@Test(expected = ForbiddenException.class)
public void cannot_get_all_users() {
AccessToken accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ME);
OSIAM_CONNECTOR.getAllUsers(accessToken);
}
示例10: cannot_get_other_user
import org.osiam.client.exception.ForbiddenException; //导入依赖的package包/类
@Test(expected = ForbiddenException.class)
public void cannot_get_other_user() {
AccessToken accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ME);
OSIAM_CONNECTOR.getUser(OTHER_USER_ID, accessToken);
}
示例11: cannot_delete_other_user
import org.osiam.client.exception.ForbiddenException; //导入依赖的package包/类
@Test(expected = ForbiddenException.class)
public void cannot_delete_other_user() {
AccessToken accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ME);
OSIAM_CONNECTOR.deleteUser(OTHER_USER_ID, accessToken);
}
示例12: cannot_get_group
import org.osiam.client.exception.ForbiddenException; //导入依赖的package包/类
@Test(expected = ForbiddenException.class)
public void cannot_get_group() {
AccessToken accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ME);
OSIAM_CONNECTOR.getGroup(GROUP_ID, accessToken);
}
示例13: cannot_delete_group
import org.osiam.client.exception.ForbiddenException; //导入依赖的package包/类
@Test(expected = ForbiddenException.class)
public void cannot_delete_group() {
AccessToken accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ME);
OSIAM_CONNECTOR.deleteGroup(GROUP_ID, accessToken);
}
示例14: cannot_get_all_groups
import org.osiam.client.exception.ForbiddenException; //导入依赖的package包/类
@Test(expected = ForbiddenException.class)
public void cannot_get_all_groups() {
AccessToken accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ME);
OSIAM_CONNECTOR.getAllGroups(accessToken);
}
示例15: cannot_revoke_all_access_tokens_of_another_user
import org.osiam.client.exception.ForbiddenException; //导入依赖的package包/类
@Test(expected = ForbiddenException.class)
public void cannot_revoke_all_access_tokens_of_another_user() {
AccessToken accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ME);
OSIAM_CONNECTOR.revokeAllAccessTokens(OTHER_USER_ID, accessToken);
}