Examples of AuthUser


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

    AuthInitializationService authInitService = initProviderProvider.get();

    AuthInitialization authInit = authInitService.get();

    AuthUser user = userServices.getUserFromEmailAddress(emailAddress);

    ValidateEmailAddressResult result;

    Map<String, IAuthService> authSources =
        authSourceProvider.getAuthServices();

    //If the returned user is null, the given email address is not known,
    //so the result should indicate this and return the list of auth
    //providers
    if (user == null) {

      //Save the email address the user validated against with in the auth
      //initialization.  This must match any imediately subsequent
      //requests for regisration
      authInit.setEmailAddress(a.getEmailAddress());
      authInitService.save(authInit);

      ArrayList<AuthSourceInfo> authSourceInfos =
          new ArrayList<AuthSourceInfo>();

      for (IAuthService authService : authSources.values()) {
        authSourceInfos.add(authService.getInfo());
      }

      result = new ValidateEmailAddressResult(a.getEmailAddress(),
          authSourceInfos);
    } else {

      //else the user needs to be redirected to the registered user's
      //auth service's login url.

      String serviceName = user.getAuthServiceName();
      emailAddress = user.getSanitizedEmailAddress();

      IAuthService authService = authSources.get(serviceName);

      if (authService == null) {
        throw new AuthException("The auth service that user: "
            + emailAddress + " used to "
            + "authenticate, " + serviceName + " "
            + "was not found in the list of auth sources");
      }

      authInit.setAuthServiceName(serviceName);
      authInit.setEmailAddress(emailAddress);
      authInit.setState(AuthInitializationState.authenticating);
      authInit.setServiceSpecificUserId(user.getServiceSpecificUserId());

      authInitService.save(authInit);

      result = new ValidateEmailAddressResult(authService.getSignInUrl());
    }
View Full Code Here

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

    if (session != null) {
      throw new AlreadyAuthenticatedException();
    }
   
    //Doublecheck that no users already have the given email address
    AuthUser user = userServices.getUserFromEmailAddress(emailAddress);
   
    if (user != null) {
      throw new EmailAddressTakenException();
    }
   
View Full Code Here

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

   * @return
   */
  @Override
  public AuthUser registerNewUser(AuthInitialization authInit) {
   
    AuthUser result = new AuthUser();
   
    result.setEmailAddress(authInit.getEmailAddress());
    result.setAuthServiceName(authInit.getAuthServiceName());
    result.setServiceSpecificUserId(authInit.getServiceSpecificUserId());
   
    registerUser(result);
   
    return result;
  }
View Full Code Here

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

    }
   
    authInit.setServiceSpecificSessionId(serviceSpecificSessionId);
    authInit.setServiceSpecificUserId(serviceSpecificUserId);
   
    AuthUser user;
   
    //Try to register the user.  Catch unique field exceptions to detect
    //email address already taken and external account already cleamed
    //scenarios
    try {
View Full Code Here

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

      return AuthState.externalUserIdMismatch;
    }
   
    authInit.setServiceSpecificSessionId(serviceSpecificSessionId);
   
    AuthUser user = userService.getUserFromEmailAddress(
        authInit.getEmailAddress());
   
    authSessionService.create(user, authInit);
   
    return AuthState.authenticated;
View Full Code Here

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

  public void testInitiateRegistrationAddressWhenAlreadyLoggedIn() {
    AuthInitialization authInit = new AuthInitialization();
    authInit.setAuthServiceName(AuthServiceName.googleAccounts);
    authInit.setEmailAddress(env.getEmailAddress());
    authInit.setServiceSpecificUserId(env.getEmailAddress());
    AuthUser user = userService.registerNewUser(authInit);
    sessionService.create(user, authInit);
   
    try {
      InitiateRegistration action =
          new InitiateRegistration();
View Full Code Here

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

  public void testRegisteringUserThatIsAlreadyRegistered() {
    AuthInitialization authInit = new AuthInitialization();
    authInit.setAuthServiceName(AuthServiceName.googleAccounts);
    authInit.setEmailAddress(env.getEmailAddress());
    authInit.setServiceSpecificUserId(env.getEmailAddress());
    AuthUser user = userService.registerNewUser(authInit);
   
    try {
      InitiateRegistration action =
          new InitiateRegistration();
      action.setAuthResourceName(AuthServiceName.googleAccounts);
View Full Code Here

Examples of org.palo.viewapi.AuthUser

    }
  }
   
  private final void saveRoot(String sessionId, ExplorerTreeNode root) throws SessionExpiredException {
    try {
      AuthUser user = getLoggedInUser(sessionId);
      FolderService folderService = ServiceProvider.getFolderService(user);   
      Role viewerRole = null;
      for (Role role: user.getRoles()) {
        if (role.getName().equalsIgnoreCase("viewer")) {
          viewerRole = role;
          break;
        }
      }
      if (viewerRole == null) {
        for (Group g: user.getGroups()) {
          for (Role role: g.getRoles()) {
            if (role.getName().equalsIgnoreCase("viewer")) {
              viewerRole = role;
              break;
            }
View Full Code Here

Examples of org.palo.viewapi.AuthUser

   
  public void renameFolder(String sessionId, XStaticFolder folder, String newName) throws DbOperationFailedException,
      SessionExpiredException {
    FolderService folderService = ServiceProvider
      .getFolderService(getLoggedInUser(sessionId));
    AuthUser user = getLoggedInUser(sessionId);
    boolean mayWrite = false;
    for (Role r: user.getRoles()) {
      if (r.hasPermission(Right.WRITE)) {
        mayWrite = true;
        break;
      }
    }
    if (!mayWrite) {
      for (Group g: user.getGroups()) {
        for (Role r: g.getRoles()) {
          if (r.hasPermission(Right.WRITE)) {
            mayWrite = true;
            break;
          }         
View Full Code Here

Examples of org.palo.viewapi.AuthUser

    }
  }

  public boolean hasWritePermission(String sessionId) throws DbOperationFailedException,
      SessionExpiredException {
    AuthUser user = getLoggedInUser(sessionId);
    for (Role r: user.getRoles()) {
      if (r.hasPermission(Right.WRITE)) {
        return true;
      }
    }
    for (Group g: user.getGroups()) {
      for (Role r: g.getRoles()) {
        if (r.hasPermission(Right.WRITE)) {
          return true;
        }
      }     
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.