Package org.pac4j.core.profile

Examples of org.pac4j.core.profile.UserProfile


            final HtmlPage redirectionPage = getRedirectionPage(webClient, client, context);

            updateContextForAuthn(webClient, redirectionPage, context);

            final UserProfile profile = getCredentialsAndProfile(client, context);

            verifyProfile(profile);

            // Java serialization
            byte[] bytes = TestsHelper.serialize(profile);
            final UserProfile profile2 = (UserProfile) TestsHelper.unserialize(bytes);
            verifyProfile(profile2);

            // like CAS serialization
            final Map<String, Object> attributes = profile2.getAttributes();
            final Map<String, Object> newAttributes = new HashMap<String, Object>();
            for (final String key : attributes.keySet()) {
                newAttributes.put(key, attributes.get(key).toString());
            }
            final UserProfile profile3 = ProfileHelper.buildProfile(profile2.getTypedId(), newAttributes);
            verifyProfile(profile3);

            // Kryo serialization
            final Kryo kryo = new Kryo();
            kryo.register(HashMap.class);
            kryo.register(Locale.class, new LocaleSerializer());
            kryo.register(Date.class);
            kryo.register(FormattedDate.class, new FormattedDateSerializer());
            kryo.register(Gender.class);
            kryo.register(Color.class, new ColorSerializer());
            kryo.register(ArrayList.class);
            registerForKryo(kryo);
            bytes = TestsHelper.serializeKryo(kryo, profile);
            final UserProfile profile4 = (UserProfile) TestsHelper.unserializeKryo(kryo, bytes);
            verifyProfile(profile4);
        } finally {
            ProfileHelper.setKeepRawData(false);
        }
    }
View Full Code Here


    protected UserProfile getCredentialsAndProfile(final Client client, final WebContext context) throws Exception {

        final Credentials credentials = client.getCredentials(context);
        logger.debug("credentials : {}", credentials);

        final UserProfile profile = client.getUserProfile(credentials, context);
        return profile;
    }
View Full Code Here

            final HtmlPage redirectionPage = getRedirectionPage(webClient, client, context);

            updateContextForCancel(redirectionPage, context);

            final UserProfile profile = getCredentialsAndProfile(client, context);

            assertNull(profile);
        }
    }
View Full Code Here

* and push it into the request.
*/
public class Pac4jProfileHandler implements Handler {
  @Override
  public void handle(final Context context) throws Exception {
    UserProfile userProfile = getUserProfile(context);
    if (userProfile != null) {
      registerUserProfile(context, userProfile);
    }
    context.next();
  }
View Full Code Here

    this.authorizer = authorizer;
  }

  @Override
  public void handle(final Context context) throws Exception {
    UserProfile userProfile = getUserProfile(context);
    if (authorizer.isAuthenticationRequired(context) && userProfile == null) {
      initiateAuthentication(context);
    } else {
      if (userProfile != null) {
        registerUserProfile(context, userProfile);
View Full Code Here

TOP

Related Classes of org.pac4j.core.profile.UserProfile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.