Package org.olat.basesecurity

Examples of org.olat.basesecurity.Authentication


    saveButton.setVisible(visible);
    cancelButton.setVisible(visible);
    passwordEl.setVisible(visible);
    confirmPasswordEl.setVisible(visible);
   
    Authentication auth = ManagerFactory.getManager().findAuthentication(ureq.getIdentity(), WebDAVAuthManager.PROVIDER_WEBDAV);
    String passwordPlaceholderKey = auth == null ? "pwdav.password.not_set" : "pwdav.password.set";
    String passwordPlaceholder = getTranslator().translate(passwordPlaceholderKey);
    passwordStaticEl.setValue(passwordPlaceholder);
   
    String buttonPlaceholderKey = auth == null ? "pwdav.password.new" : "pwdav.password.change";
View Full Code Here


   * @return True if authentication is valid
   */
  private boolean validAuthentication(Identity identity, String token) {
    boolean valid = false;
    Manager secMgr = ManagerFactory.getManager();
    Authentication authentication = secMgr.findAuthenticationByAuthusername(identity.getKey().toString(), TOKEN_PROVIDER);
    if (authentication != null && authentication.getCredential().equals(token)) {
      valid = true;
    }
    return valid;
  }
View Full Code Here

   * if enabled in the configuration some testusers for IM are created in the
   * database. It has nothing to do with accounts on the jabber server itself.
   */
  private void checkAndCreateTestUsers() {
    Identity identity;
    Authentication auth;
    Manager securityManager = ManagerFactory.getManager();
    identity = securityManager.findIdentityByName("author");
    auth = ManagerFactory.getManager().findAuthentication(identity, ClientManager.PROVIDER_INSTANT_MESSAGING);
    if (auth == null) { // create new authentication for provider
      ManagerFactory.getManager().createAndPersistAuthentication(identity, ClientManager.PROVIDER_INSTANT_MESSAGING, identity.getName(),
View Full Code Here

    rosterForm = new RosterForm("rosterform", getTranslator(), imPrefs);
    rosterForm.addListener(this);
    myContent.put("rosterform", rosterForm);
   
    myContent.contextPut("chatusername", InstantMessagingModule.getAdapter().getUserJid(changeableIdentity.getName()));
    Authentication auth = ManagerFactory.getManager().findAuthentication(changeableIdentity, ClientManager.PROVIDER_INSTANT_MESSAGING);
    if (auth == null) {
      // somehow this is a messed up user. happens sometimes with the default users when IM server is not running at first startup
      logError("Could not find authentication for identity::" + changeableIdentity.getName() + " and provider::" + ClientManager.PROVIDER_INSTANT_MESSAGING + "; Please fix this users Instant Messaging password manually", null);
    } else {
      myContent.contextPut("password", auth.getCredential());
    }
   
    putInitialPanel(myContent);
  }
View Full Code Here

    }

    if (identity != null) {
      // The identity can be null for guests
      String idKey = identity.getKey().toString();
      Authentication authentication = manager.findAuthenticationByAuthusername(idKey, TOKEN_PROVIDER);
      if (authentication == null) {
        // Create an authentication
        String token = RandomStringUtils.randomAlphanumeric(6);
        authentication = manager.createAndPersistAuthentication(identity, TOKEN_PROVIDER, idKey, token);
      }
      // If the repository entry allows guest access it is public, thus not
      // private.
      boolean isPrivate = true;
      RepositoryEntry entry = RepositoryManager.getInstance().lookupRepositoryEntry(feed, false);
      if (entry != null && entry.getAccess() == RepositoryEntry.ACC_USERS_GUESTS) {
        isPrivate = false;
      }

      if (isPrivate) {
        // identity key
        uri.append(idKey);
        uri.append(slash);
        // token
        uri.append(authentication.getCredential());
        uri.append(slash);
      }
    }

    if (isCourseNode) {
View Full Code Here

      InstantMessagingModule.getAdapter().deleteAccount(testUserA);
      InstantMessagingModule.getAdapter().deleteAccount(testUserB);
      InstantMessagingModule.getAdapter().deleteAccount(testUserC);
      im.deleteRosterGroup(groupId);
     
      Authentication authC = ManagerFactory.getManager().findAuthenticationByAuthusername(testUserC, ClientManager.PROVIDER_INSTANT_MESSAGING);
      if(authC != null) ManagerFactory.getManager().deleteAuthentication(authC);
      DBFactory.getInstance().intermediateCommit();
      InstantMessagingClient imClientC = InstantMessagingModule.getAdapter().getClientManager().getInstantMessagingClient(testUserC);
      //wait some time as connection process is in background thread
      Thread.sleep(3000);
      assertTrue(imClientC.isConnected());
      imClientC.closeConnection(true);
      assertTrue(InstantMessagingModule.getAdapter().deleteAccount(testUserC));
     
      //delete IM passwords, otherwise accounts don't get created
      Authentication authA = ManagerFactory.getManager().findAuthenticationByAuthusername(testUserA, ClientManager.PROVIDER_INSTANT_MESSAGING);
      Authentication authB = ManagerFactory.getManager().findAuthenticationByAuthusername(testUserB, ClientManager.PROVIDER_INSTANT_MESSAGING);
     
      if(authA != null) ManagerFactory.getManager().deleteAuthentication(authA);
      if(authB != null) ManagerFactory.getManager().deleteAuthentication(authB);
         
      //get the IM client, it connects automatically to the server (creates an account on the im server)
View Full Code Here

            identity = UserManager.getInstance().findIdentityByEmail(emailOrUsername);
          }
        }
        if (identity != null) {
          // check if user has an OLAT provider token, otherwhise a pwd change makes no sense
          Authentication auth = ManagerFactory.getManager().findAuthentication(identity, OLATAuthenticationController.PROVIDER_OLAT);
          if (auth == null) {
            getWindowControl().setWarning(translate("password.cantchange"));
            return;
          }
          Preferences prefs = identity.getUser().getPreferences();
View Full Code Here

    if (identity == null) {
      // error - abort
      return null;
    }
    // check if this is a valid authentication
    Authentication auth = ManagerFactory.getManager().findAuthentication(identity, RSSUtil.RSS_AUTH_PROVIDER);
    if (auth == null) {
      // error, rss authentication not yet set. user must login first, then the
      // auth provider will be generated on the fly
      return null;
    }
    if (!auth.getCredential().equals(idToken)) {
      // error - wrong authentication
      return null;
    }

    // FIXME:GW Make some sensible verifications here (expire date etc.) and
View Full Code Here

        ident = findIdentInChangingEmailWorkflow(login);
      }
    }
    if (ident == null) return null;
    // find OLAT authentication provider
    Authentication auth = ManagerFactory.getManager()
      .findAuthentication(ident, OLATAuthenticationController.PROVIDER_OLAT);
    if (auth != null && auth.getCredential().equals(Encoder.encrypt(pass)))  return ident;
    Tracing.logAudit("Error authenticating user "+login+" via provider OLAT", OLATAuthenticationController.class);
    return null;
  }
View Full Code Here

    //o_clusterREVIEW
    identity = (Identity) DBFactory.getInstance().loadObject(identity);
   
    boolean allOk = false;
   
    Authentication ldapAuth = ManagerFactory.getManager().findAuthentication(identity, LDAPAuthenticationController.PROVIDER_LDAP);
    if(ldapAuth != null) {
      if(LDAPLoginModule.isPropagatePasswordChangedOnLdapServer()) {
        LDAPError ldapError = new LDAPError();
        LDAPLoginManager.getInstance().changePassword(identity, newPwd, ldapError);
        log.audit(doer.getName() + " change the password on the LDAP server for identity: " + identity.getName());
View Full Code Here

TOP

Related Classes of org.olat.basesecurity.Authentication

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.