Package org.orgama.shared.auth.model

Examples of org.orgama.shared.auth.model.AuthSession


 
    assertNotNull(result);
    assertNotNull(result.getRedirectUrl());
    assertEquals("http://127.0.0.1:8888", result.getRedirectUrl());
   
    AuthSession session = sessionService.get();
   
    assertNull(session);
  }
View Full Code Here


    assertNotNull(result);
    assertNotNull(result.getRedirectUrl());
    assertEquals("/_ah/logout?continue=http%3A%2F%2F127.0.0.1%3A8888",
        result.getRedirectUrl());
   
    AuthSession session = sessionService.get();
   
    assertNull(session);
  }
View Full Code Here

    Logger.debug("Validating " + a.getEmailAddress());

    String emailAddress = a.getEmailAddress();

    AuthSession session = sessionProviderProvider.get().get();

    if (session != null) {
      throw new AlreadyAuthenticatedException();
    }
View Full Code Here

 
  @Override
  public SignOutResult execImpl(SignOut a, ExecutionContext ec) {
   
    ICoreSessionService sessionService = sessionServicesProvider.get();
    AuthSession authSession = sessionService.get();
    String alternateRedirectUrl = null;
    SignOutResult result = new SignOutResult();
   
    if (a.isSignOutOfApp()) {
      if (authSession == null) {
        Logger.warn("Requested to log out of app when not logged in");
      }
      else {
        sessionService.close(authSession);
      }
    }
   
    if (a.isSignOutOfExternalService()) {
      String authServiceName = null;
     
      if (authSession != null) {
        authServiceName = authSession.getAuthServiceName();
      }
      else {
        authServiceName = a.getAuthServiceName();
      }
     
      if (authServiceName == null) {
        Logger.warn("No auth service could be found to log out of");
      }
      else {
        IAuthService service =
            serviceProvider.getAuthServices().get(authServiceName);
        if (service != null) {
          alternateRedirectUrl = service.getSignOutUrl(
              authSession != null
              ? authSession.getServiceSpecificSessionId()
              : null);
        }
      }
     
    }
View Full Code Here

   
    String emailAddress = a.getEmailAddress();
    String authResourceName = a.getAuthResourceName();
   
    //Check that the user is not already logged in
    AuthSession session = sessionProviderProvider.get().get();
   
    if (session != null) {
      throw new AlreadyAuthenticatedException();
    }
   
View Full Code Here

  public void testBehaviorWithValidSession() {
    String sessionId = "seasdfasdfaagagag";
   
    {
      cookieHandler.setValue(constants.getSessionCookieName(), sessionId);
      AuthSession authSession = new AuthSession();
      authSession.setExpirationDate(
          new Date(new Date().getTime() + 1000000));
      authSession.setSessionId(sessionId);
      authSession.setUserId(1);
      Ofy.save().entity(authSession).now();
    }
   
    ICompleteAuthState state = bootstrapper.bootstrap();
   
View Full Code Here

   
    String sessionId = "seasdfasdfaagagag";
   
    {
      cookieHandler.setValue(constants.getSessionCookieName(), sessionId);
      AuthSession authSession = new AuthSession();
      authSession.setExpirationDate(
          new Date(new Date().getTime() - 1000000)); //Expired
      authSession.setSessionId(sessionId);
      authSession.setUserId(1);
      Ofy.save().entity(authSession).now();
    }
   
    ICompleteAuthState state = bootstrapper.bootstrap();
   
View Full Code Here

  public void testBehaviorOnActualError() {
    String sessionId = "seasdfasdfaagagag";
   
    {
      cookieHandler.setValue(constants.getSessionCookieName(), sessionId);
      AuthSession authSession = new AuthSession();
      authSession.setExpirationDate(
          new Date(new Date().getTime() + 1000000));
      authSession.setSessionId(sessionId);
      authSession.setUserId(1);
      Ofy.save().entity(authSession).now();
    }
   
    //Set the cookie handler to throw an error on get
    ((MockCookieHandler)cookieHandler).setThrowErrorOnGet(true);
View Full Code Here

   * then null is returned. 
   * @return
   */
  @Override
  public AuthSession get() {
    AuthSession result = getImpl();
   
    if (result != null) {
      validateAuthSession(result);
    }
   
View Full Code Here

  private AuthSession getImpl() {
   
    try {
      HttpSession httpSession = sessionProvider.get();

      AuthSession authSession = (AuthSession)httpSession.getAttribute(
          serverSideConstants.getAuthSessionKey());

      if (authSession != null) {
        return authSession;
      }
View Full Code Here

TOP

Related Classes of org.orgama.shared.auth.model.AuthSession

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.