Package org.orgama.server.auth.model

Examples of org.orgama.server.auth.model.CompleteAuthState


            Injector.class.getName());

    AuthBootstrapper authBootstrapper = injector.getInstance(
        AuthBootstrapper.class);

    CompleteAuthState authState = authBootstrapper.bootstrap();
   
    try {
      pageContext.getOut().write(String.format(
          "<script language='javascript' type='text/javascript'>" +
              "var ___authState___=\"%s\";" +
              "var ___authServiceName___=%s;" +
          "</script>",
          authState.getAuthState().toString(),
          authState.getAuthServiceName() == null
              ? "null"
              : "\"" + authState.getAuthServiceName() + "\""));
    }
    catch(Exception ex) {
      logger.severe("Error writing auth state to jsp.  " +
          ex.getMessage());
    }
View Full Code Here


  /**
   * Bootstrap the authentication process on the current request.
   * @return
   */
  public CompleteAuthState bootstrap() {
    CompleteAuthState result = new CompleteAuthState();
   
    try {
      AuthSession authSession = null;
     
      // Try to get the existing auth session.  While bootstrapping,
      // errors in this step will lead to resetting of the auth process
      try {
        authSession = authSessionService.get();
      }
      catch(AuthException ax) {
        Logger.error("Authentication error while trying to get auth " +
            "session.  Reseting auth system in clean state", ax);
        authSystemCleanerProvider.get().clean();
      }
     
      if (authSession != null) {
        result.setAuthState(AuthState.authenticated);
        result.setAuthServiceName(authSession.getAuthServiceName());
        return result;
      }
     
      //Reaching this step means there was no existing auth session. 
      //In stead get the auth initialization
      AuthInitialization authInit =
          authInitService.get();
      result.setAuthServiceName(authInit.getAuthServiceName());
     
      switch (authInit.getState()) {
        case nil: { //Implies user has not started authenticating yet
          result.setAuthState(AuthState.nil);
          break;
        }
        case registering: {
          result.setAuthState(handleRegistration(authInit));
          break;
        }
        case authenticating: {
          result.setAuthState(handleAuthentication(authInit));
        }
      }
    }
    catch(Exception ex) {
      Logger.error("Error bootstrapping authentication", ex);
      result.setAuthState(AuthState.serverError);
    }
   
    return result;
  }
View Full Code Here

TOP

Related Classes of org.orgama.server.auth.model.CompleteAuthState

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.