本文整理汇总了Java中org.pac4j.core.profile.CommonProfile.setClientName方法的典型用法代码示例。如果您正苦于以下问题:Java CommonProfile.setClientName方法的具体用法?Java CommonProfile.setClientName怎么用?Java CommonProfile.setClientName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pac4j.core.profile.CommonProfile
的用法示例。
在下文中一共展示了CommonProfile.setClientName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testReturnNewProfile
import org.pac4j.core.profile.CommonProfile; //导入方法依赖的package包/类
@Test
public void testReturnNewProfile() throws HttpAction {
final CommonProfile profile = new CommonProfile();
profile.setId(ID);
profile.addAttribute(KEY, VALUE);
profile.setRemembered(false);
profile.addRole(NAME);
profile.addPermission(VALUE);
profile.setClientName(CLIENT_NAME);
final Credentials credentials = new TokenCredentials(TOKEN, CLIENT_NAME);
credentials.setUserProfile(profile);
final AuthenticatorProfileCreator creator = new AuthenticatorProfileCreator();
creator.setProfileFactory(MyCommonProfile::new);
final CommonProfile profile2 = creator.create(credentials, null);
assertTrue(profile2 instanceof MyCommonProfile);
assertEquals(profile.getId(), profile2.getId());
assertEquals(profile.getAttributes(), profile2.getAttributes());
assertEquals(profile.getRoles(), profile2.getRoles());
assertEquals(profile.getPermissions(), profile2.getPermissions());
assertEquals(profile.isRemembered(), profile2.isRemembered());
assertEquals(profile.getClientName(), profile2.getClientName());
}
示例2: testSingleProfileFromSessionDirectly
import org.pac4j.core.profile.CommonProfile; //导入方法依赖的package包/类
@Test(timeout = 1000)
public void testSingleProfileFromSessionDirectly(final TestContext testContext) {
final CommonProfile profile = new CommonProfile();
profile.setClientName(CLIENT1);
testProfilesInSessionAfter(webContext.getSessionStore().set(webContext, USER_PROFILES, profile),
v -> completedFuture(null),
assertProfileListReturned(profile),
testContext);
}
示例3: testSingleProfileFromRequestDirectly
import org.pac4j.core.profile.CommonProfile; //导入方法依赖的package包/类
@Test(timeout = 1000)
public void testSingleProfileFromRequestDirectly(final TestContext testContext) {
final CommonProfile profile = new CommonProfile();
profile.setClientName(CLIENT1);
webContext.setRequestAttribute(USER_PROFILES, profile);
final Async async = testContext.async();
profileManager.getAll(false)
.thenAccept(l -> executionContext.runOnContext(() -> {
assertThat(l, is(Arrays.asList(profile)));
async.complete();
}));
}