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


Java ProfileHelper类代码示例

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


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

示例1: verifyProfile

import org.pac4j.core.profile.ProfileHelper; //导入依赖的package包/类
@Override
protected void verifyProfile(final CommonProfile userProfile) {
    final OidcProfile profile = (OidcProfile) userProfile;
    assertEquals("00u5h0czw1aIjTQtM0h7", profile.getId());
    assertEquals(OidcProfile.class.getName() + CommonProfile.SEPARATOR + "00u5h0czw1aIjTQtM0h7",
            profile.getTypedId());
    assertNotNull(profile.getAccessToken());
    assertNotNull(profile.getIdToken());
    assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), OidcProfile.class));
    assertNotNull(profile.getIdTokenString());
    assertCommonProfile(profile, getLogin(), "Test", "pac4j", "Test pac4j", "[email protected]",
            Gender.UNSPECIFIED, new Locale("en", "US"), null, null, "America/Los_Angeles");
    assertTrue((Boolean) profile.getAttribute("email_verified"));
    assertNotNull(profile.getAttribute("at_hash"));
    assertEquals("1", profile.getAttribute("ver").toString());
    assertNotNull(profile.getAmr());
    assertEquals("https://dev-425954.oktapreview.com", profile.getIssuer());
    assertEquals("ZuxDX1Gw2Kvx4gFyDNWC", profile.getAudience().get(0));
    assertEquals("00o5gxpohzF1JWEXZ0h7", profile.getAttribute("idp"));
    assertNotNull(profile.getAuthTime());
    assertNotNull(profile.getExpirationDate());
    assertNotNull(profile.getIssuedAt());
    assertNotNull(profile.getAttribute("jti"));
    assertEquals(22, profile.getAttributes().size());
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:26,代码来源:RunOkta.java

示例2: verifyProfile

import org.pac4j.core.profile.ProfileHelper; //导入依赖的package包/类
@Override
protected void verifyProfile(final CommonProfile userProfile) {
    final GoogleOidcProfile profile = (GoogleOidcProfile) userProfile;
    assertEquals("113675986756217860428", profile.getId());
    assertEquals(GoogleOidcProfile.class.getName() + CommonProfile.SEPARATOR + "113675986756217860428",
            profile.getTypedId());
    assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), GoogleOidcProfile.class));
    assertNotNull(profile.getAccessToken());
    assertNotNull(profile.getIdTokenString());
    assertCommonProfile(profile, getLogin(), "Jérôme", "ScribeUP", "Jérôme ScribeUP", null,
            Gender.MALE, Locale.ENGLISH,
            "https://lh4.googleusercontent.com/-fFUNeYqT6bk/AAAAAAAAAAI/AAAAAAAAAAA/5gBL6csVWio/photo.jpg",
            "https://plus.google.com/113675986756217860428", null);
    assertTrue(profile.getEmailVerified());
    assertEquals("https://accounts.google.com", profile.getIssuer());
    assertEquals("682158564078-ndcjc83kp5v7vudikqu1fudtkcs2odeb.apps.googleusercontent.com", profile.getAzp());
    assertNotNull(profile.getExpirationDate());
    assertNotNull(profile.getIssuedAt());
    assertNotNull(profile.getAttribute("at_hash"));
    assertEquals("682158564078-ndcjc83kp5v7vudikqu1fudtkcs2odeb.apps.googleusercontent.com", profile.getAudience().get(0));
    assertEquals(18, profile.getAttributes().size());
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:23,代码来源:RunGoogleOidcClient.java

示例3: verifyProfile

import org.pac4j.core.profile.ProfileHelper; //导入依赖的package包/类
@Override
protected void verifyProfile(final CommonProfile userProfile) {
    final OidcProfile profile = (OidcProfile) userProfile;
    assertEquals("90342.ASDFJWFA", profile.getId());
    assertEquals(OidcProfile.class.getName() + CommonProfile.SEPARATOR + "90342.ASDFJWFA",
            profile.getTypedId());
    assertNotNull(profile.getAccessToken());
    assertNotNull(profile.getIdToken());
    assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), OidcProfile.class));
    assertNotNull(profile.getIdTokenString());
    assertCommonProfile(profile, "[email protected]", null, null, "Demo Admin", "admin",
            Gender.UNSPECIFIED, null, null, null, null);
    assertTrue((Boolean) profile.getAttribute("email_verified"));
    assertEquals("https://mitreid.org/", profile.getIssuer());
    assertEquals("acdf79d7-0129-4ba3-bc61-a52486cf82ff", profile.getAudience().get(0));
    assertNotNull(profile.getAuthTime());
    assertNotNull(profile.getExpirationDate());
    assertNotNull(profile.getIssuedAt());
    assertNotNull(profile.getAttribute("jti"));
    assertEquals(13, profile.getAttributes().size());
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:22,代码来源:RunMitreIdOrg.java

示例4: verifyProfile

import org.pac4j.core.profile.ProfileHelper; //导入依赖的package包/类
@Override
protected void verifyProfile(CommonProfile userProfile) {
    final Google2Profile profile = (Google2Profile) userProfile;
    assertEquals("113675986756217860428", profile.getId());
    assertEquals(Google2Profile.class.getName() + CommonProfile.SEPARATOR + "113675986756217860428",
            profile.getTypedId());
    assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), Google2Profile.class));
    assertTrue(CommonHelper.isNotBlank(profile.getAccessToken()));
    assertCommonProfile(userProfile, "[email protected]", "Jérôme", "ScribeUP", "Jérôme ScribeUP", null,
            Gender.MALE, Locale.ENGLISH,
            "https://lh4.googleusercontent.com/-fFUNeYqT6bk/AAAAAAAAAAI/AAAAAAAAAAA/5gBL6csVWio/photo.jpg",
            "https://plus.google.com/113675986756217860428", null);
    assertNull(profile.getBirthday());
    assertTrue(profile.getEmails() != null && profile.getEmails().size() == 1);
    assertEquals(9, profile.getAttributes().size());
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:17,代码来源:RunGoogle2Client.java

示例5: verifyProfile

import org.pac4j.core.profile.ProfileHelper; //导入依赖的package包/类
@Override
protected void verifyProfile(CommonProfile userProfile) {
    final WordPressProfile profile = (WordPressProfile) userProfile;
    logger.debug("userProfile : {}", profile);
    assertEquals("35944437", profile.getId());
    assertEquals(WordPressProfile.class.getName() + CommonProfile.SEPARATOR + "35944437", profile.getTypedId());
    assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), WordPressProfile.class));
    assertTrue(CommonHelper.isNotBlank(profile.getAccessToken()));
    assertCommonProfile(userProfile, "[email protected]", null, null, "testscribeup", "testscribeup",
            Gender.UNSPECIFIED, null,
            "https://0.gravatar.com/avatar/67c3844a672979889c1e3abbd8c4eb22?s=96&d=identicon&r=G",
            "http://en.gravatar.com/testscribeup", null);
    assertEquals(36224958, profile.getPrimaryBlog().intValue());
    final WordPressLinks links = profile.getLinks();
    assertEquals("https://public-api.wordpress.com/rest/v1/me", links.getSelf());
    assertEquals("https://public-api.wordpress.com/rest/v1/me/help", links.getHelp());
    assertEquals("https://public-api.wordpress.com/rest/v1/sites/36224958", links.getSite());
    assertEquals(8, profile.getAttributes().size());
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:20,代码来源:RunWordPressClient.java

示例6: verifyProfile

import org.pac4j.core.profile.ProfileHelper; //导入依赖的package包/类
@Override
protected void verifyProfile(CommonProfile userProfile) {
    final GenericOAuth20Profile profile = (GenericOAuth20Profile) userProfile;
    profile.setAttributesDefinition(new Google2AttributesDefinition());
    assertEquals("113675986756217860428", profile.getId());
    assertEquals(GenericOAuth20StateClient.class.getName() + CommonProfile.SEPARATOR + "113675986756217860428",
            profile.getTypedId());
    assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), GenericOAuth20Profile.class));
    assertTrue(CommonHelper.isNotBlank(profile.getAccessToken()));
    assertCommonProfile(userProfile, "[email protected]", "Jérôme", "ScribeUP", "Jérôme ScribeUP", null,
            Gender.MALE, Locale.ENGLISH,
            "https://lh4.googleusercontent.com/-fFUNeYqT6bk/AAAAAAAAAAI/AAAAAAAAAAA/5gBL6csVWio/photo.jpg",
            "https://plus.google.com/113675986756217860428", null);
    assertNull(profile.getAttribute("birthday"));
    List<Google2Email> emails = (List<Google2Email>) profile.getAttribute("emails");
    assertTrue(emails != null && emails.size() == 1);
    assertEquals(9, profile.getAttributes().size());
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:19,代码来源:RunGeneric20StateClient.java

示例7: verifyProfile

import org.pac4j.core.profile.ProfileHelper; //导入依赖的package包/类
@Override
protected void verifyProfile(CommonProfile userProfile) {
    final FoursquareProfile profile = (FoursquareProfile) userProfile;
    assertEquals("81827700", profile.getId());
    assertEquals(FoursquareProfile.class.getName() + CommonProfile.SEPARATOR + "81827700", profile.getTypedId());
    assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), FoursquareProfile.class));
    assertCommonProfile(userProfile,
            "[email protected]",
            "Pac4j",
            "Pac4j",
            null,
            null,
            Gender.UNSPECIFIED,
            null,
            "https://irs0.4sqi.net/img/user/original/blank_boy.png",
            "https://foursquare.com/user/81827700", "");
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:18,代码来源:RunFoursquareClient.java

示例8: verifyProfile

import org.pac4j.core.profile.ProfileHelper; //导入依赖的package包/类
@Override
protected void verifyProfile(CommonProfile userProfile) {
    final OkProfile profile = (OkProfile) userProfile;
    assertEquals(TEST_PROFILE_ID, profile.getId());
    assertEquals(OkProfile.class.getName() + CommonProfile.SEPARATOR + TEST_PROFILE_ID,
            profile.getTypedId());
    assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), OkProfile.class));
    assertTrue(CommonHelper.isNotBlank(profile.getAccessToken()));
    assertCommonProfile(
            userProfile,
            null,
            TEST_FIRST_NAME,
            TEST_LAST_NAME,
            TEST_FIRST_NAME + " " + TEST_LAST_NAME,
            TEST_PROFILE_ID,
            Gender.MALE,
            new Locale(TEST_LOCALE),
            TEST_PROFILE_PICTURE_URL,
            OkProfile.BASE_PROFILE_URL + TEST_PROFILE_ID,
            TEST_LOCATION);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:22,代码来源:RunOkClient.java

示例9: verifyProfile

import org.pac4j.core.profile.ProfileHelper; //导入依赖的package包/类
@Override
protected void verifyProfile(CommonProfile userProfile) {
    final PayPalProfile profile = (PayPalProfile) userProfile;
    assertEquals("YAxf5WKSFn4BG_l3wqcBJUSObQTG1Aww5FY0EDf_ccw", profile.getId());
    assertEquals(PayPalProfile.class.getName() + CommonProfile.SEPARATOR
            + "YAxf5WKSFn4BG_l3wqcBJUSObQTG1Aww5FY0EDf_ccw", profile.getTypedId());
    assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), PayPalProfile.class));
    assertTrue(CommonHelper.isNotBlank(profile.getAccessToken()));
    assertCommonProfile(userProfile, "[email protected]", "Test", "ScribeUP", "Test ScribeUP", null,
            Gender.UNSPECIFIED, Locale.FRANCE, null, null, "Europe/Berlin");
    final PayPalAddress address = profile.getAddress();
    assertEquals("FR", address.getCountry());
    assertEquals("Paris", address.getLocality());
    assertEquals("75001", address.getPostalCode());
    assertEquals("Adr1", address.getStreetAddress());
    final Locale language = profile.getLanguage();
    assertEquals(Locale.FRANCE, language);
    assertEquals(9, profile.getAttributes().size());
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:20,代码来源:RunPaypalClient.java

示例10: ClientAction

import org.pac4j.core.profile.ProfileHelper; //导入依赖的package包/类
/**
 * Build the action.
 *
 * @param theCentralAuthenticationService The service for CAS authentication
 * @param theClients The clients for authentication
 */
public ClientAction(final CentralAuthenticationService theCentralAuthenticationService,
        final Clients theClients) {
    this.centralAuthenticationService = theCentralAuthenticationService;
    this.clients = theClients;
    ProfileHelper.setKeepRawData(true);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:13,代码来源:ClientAction.java

示例11: testGetCredentialsUserProfile

import org.pac4j.core.profile.ProfileHelper; //导入依赖的package包/类
@Test
public void testGetCredentialsUserProfile() throws HttpAction {
    final GaeUserCredentials credentials = client.getCredentials(context);
    final User user = credentials.getUser();
    assertEquals(EMAIL, user.getEmail());
    assertEquals("", user.getAuthDomain());
    final GaeUserServiceProfile profile = client.getUserProfile(credentials, context);
    logger.debug("userProfile: {}", profile);
    assertEquals(EMAIL, profile.getId());
    assertEquals(GaeUserServiceProfile.class.getName() + CommonProfile.SEPARATOR + EMAIL, profile.getTypedId());
    assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), GaeUserServiceProfile.class));
    assertEquals("test", profile.getDisplayName());
    assertTrue(profile.getRoles().contains("GLOBAL_ADMIN"));
    assertEquals(2, profile.getAttributes().size());
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:16,代码来源:GaeUserServiceClientTests.java

示例12: verifyProfile

import org.pac4j.core.profile.ProfileHelper; //导入依赖的package包/类
@Override
protected void verifyProfile(final CommonProfile userProfile) {
    final AzureAdProfile profile = (AzureAdProfile) userProfile;
    assertEquals("alVNQ8eaO_Psdu7MIYRy5oGbqe5YD2BxKlDm3rwXseE", profile.getId());
    assertEquals(AzureAdProfile.class.getName() + CommonProfile.SEPARATOR + "alVNQ8eaO_Psdu7MIYRy5oGbqe5YD2BxKlDm3rwXseE",
            profile.getTypedId());
    assertNotNull(profile.getAccessToken());
    assertNotNull(profile.getIdToken());
    assertNotNull(profile.getRefreshToken());
    assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), AzureAdProfile.class));
    assertNotNull(profile.getIdTokenString());
    assertCommonProfile(profile, getLogin(), "Jérôme", "TESTPAC4J", "MyDisplayName", null,
            Gender.UNSPECIFIED, null, null, null, null);
    assertEquals("live.com", profile.getIdp());
    assertEquals("6c59c433-11b5-4fb1-9641-40b829e7a8e4", profile.getOid());
    assertEquals("38c46e5a-21f0-46e5-940d-3ca06fd1a330", profile.getTid());
    assertEquals("1.0", profile.getVer());
    assertNotNull(profile.getAmr());
    assertNotNull(profile.getIssuer());
    assertEquals("788339d7-1c44-4732-97c9-134cb201f01f", profile.getAudience().get(0));
    assertEquals("live.com#" + getLogin(), profile.getUniqueName());
    assertNotNull(profile.getNbf());
    assertEquals("live.com", profile.getIdp());
    assertNotNull(profile.getExpirationDate());
    assertNotNull(profile.getIpaddr());
    assertNotNull(profile.getIssuedAt());
    assertNotNull(profile.getAttribute("sub"));
    assertNull(profile.getAttribute("pwd_exp"));
    assertEquals(20, profile.getAttributes().size());
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:31,代码来源:RunAzureAdClient.java

示例13: testNoAttribute

import org.pac4j.core.profile.ProfileHelper; //导入依赖的package包/类
@Test
public void testNoAttribute() {
    AuthorizationGenerator<CommonProfile> generator = new DefaultCasAuthorizationGenerator<CommonProfile>();
    Map<String, Object> attributes = new HashMap<String, Object>();
    CommonProfile profile = (CommonProfile) ProfileHelper.buildProfile("CasProfile#id", attributes);
    generator.generate(profile);
    assertEquals(false, profile.isRemembered());
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:9,代码来源:DefaultCasAuthorizationGeneratorTests.java

示例14: testBadAttributeValue

import org.pac4j.core.profile.ProfileHelper; //导入依赖的package包/类
@Test
public void testBadAttributeValue() {
    AuthorizationGenerator<CommonProfile> generator = new DefaultCasAuthorizationGenerator<CommonProfile>();
    Map<String, Object> attributes = new HashMap<String, Object>();
    attributes.put(DefaultCasAuthorizationGenerator.DEFAULT_REMEMBER_ME_ATTRIBUTE_NAME, "yes");
    CommonProfile profile = (CommonProfile) ProfileHelper.buildProfile("CasProfile#id", attributes);
    generator.generate(profile);
    assertEquals(false, profile.isRemembered());
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:10,代码来源:DefaultCasAuthorizationGeneratorTests.java

示例15: testIsNotRemembered

import org.pac4j.core.profile.ProfileHelper; //导入依赖的package包/类
@Test
public void testIsNotRemembered() {
    AuthorizationGenerator<CommonProfile> generator = new DefaultCasAuthorizationGenerator<CommonProfile>();
    Map<String, Object> attributes = new HashMap<String, Object>();
    attributes.put(DefaultCasAuthorizationGenerator.DEFAULT_REMEMBER_ME_ATTRIBUTE_NAME, "false");
    CommonProfile profile = (CommonProfile) ProfileHelper.buildProfile("CasProfile#id", attributes);
    generator.generate(profile);
    assertEquals(false, profile.isRemembered());
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:10,代码来源:DefaultCasAuthorizationGeneratorTests.java


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