Package org.olat.basesecurity

Examples of org.olat.basesecurity.Authentication


        }
        DispatcherAction.sendBadRequest(req.getPathInfo(), resp);
        return;
      }
     
      Authentication auth = ManagerFactory.getManager().findAuthenticationByAuthusername(uniqueID, PROVIDER_SHIB);
      if (auth == null) { // no matching authentication...
        ShibbolethRegistrationController.putShibAttributes(req, attributesMap);
        ShibbolethRegistrationController.putShibUniqueID(req, uniqueID);
        redirectToShibbolethRegistration(resp);
        return;
      }
      int loginStatus = AuthHelper.doLogin(auth.getIdentity(), ShibbolethDispatcher.PROVIDER_SHIB, ureq);
      if (loginStatus != AuthHelper.LOGIN_OK) {
        if (loginStatus == AuthHelper.LOGIN_NOTAVAILABLE) {
          DispatcherAction.redirectToServiceNotAvailable(resp);
        }
        DispatcherAction.redirectToDefaultDispatcher(resp); // error, redirect to login screen
View Full Code Here


        }
      }
      // Add or update an OLAT authentication token for this user if configured in the module
      if (identity != null && LDAPLoginModule.isCacheLDAPPwdAsOLATPwdOnLogin()) {
        Manager secMgr = ManagerFactory.getManager();
        Authentication auth = secMgr.findAuthentication(identity, OLATAuthenticationController.PROVIDER_OLAT);
        if (auth == null) {
          // Reuse exising authentication token
          secMgr.createAndPersistAuthentication(identity, OLATAuthenticationController.PROVIDER_OLAT, username, Encoder.encrypt(pwd));
        } else {
          // Create new authenticaten token
          auth.setCredential(Encoder.encrypt(pwd));
          DBFactory.getInstance().updateObject(auth);
        }       
      }
      return identity;
    }
View Full Code Here

      if (ldapGroup == null) {
        log.error("Error getting user from OLAT security group '" + LDAPConstants.SECURITY_GROUP_LDAP + "' : group does not exist");
        return null;
      }
      if (securityManager.isIdentityInSecurityGroup(identity, ldapGroup)) {
        Authentication ldapAuth = ManagerFactory.getManager().findAuthentication(identity, LDAPAuthenticationController.PROVIDER_LDAP);
        if(ldapAuth == null) {
          //BUG Fixe: update the user and test if it has a ldap provider
          ManagerFactory.getManager().createAndPersistAuthentication(identity, LDAPAuthenticationController.PROVIDER_LDAP, identity.getName(), null);
        }
        return identity;
View Full Code Here

        if(admin) {
          log.audit("No OLAT Auth. provider migrated for admin: " + identity.getName());
          continue;
        }

        Authentication olatAuth = null, webDAVAuth = null, shibAuth = null;
        List<Authentication> auths = secMgr.getAuthentications(identity);
        for(Authentication auth:auths) {
          if(WebDAVAuthManager.PROVIDER_WEBDAV.equals(auth.getProvider())) {
            webDAVAuth = auth;
          } else if(OLATAuthenticationController.PROVIDER_OLAT.equals(auth.getProvider())) {
            olatAuth = auth;
          } else if(ShibbolethDispatcher.PROVIDER_SHIB.equals(auth.getProvider())) {
            shibAuth = auth;
          }
        }
       
        if(webDAVAuth == null && olatAuth != null && shibAuth != null) {
          String hashedPwd = olatAuth.getCredential();
          log.audit("Create WebDAV Auth. provider for: " + identity.getName());
          webDAVAuth = ManagerFactory.getManager().createAndPersistAuthentication(identity, WebDAVAuthManager.PROVIDER_WEBDAV, identity.getName(), hashedPwd);
          if(webDAVAuth != null) {
            log.audit("Delete OLAT Auth. provider for: " + identity.getName());
            ManagerFactory.getManager().deleteAuthentication(olatAuth);
View Full Code Here

   */
  public static String putPersonalRssTokenInSession(UserRequest ureq) {
    Identity identity = ureq.getIdentity();
    String token = null;
    Manager secManager = ManagerFactory.getManager();
    Authentication auth = secManager.findAuthentication(identity, RSSUtil.RSS_AUTH_PROVIDER);
    if (auth == null) {
      // no token found - create one
       token = RandomStringUtils.randomAlphanumeric(6);
       auth = secManager.createAndPersistAuthentication(identity, RSSUtil.RSS_AUTH_PROVIDER, identity.getName(), token);
    } else {
      token = auth.getCredential();
    }
    ureq.getUserSession().putEntry(RSSUtil.RSS_AUTH_TOKEN_KEY, token);
    return token;
  }
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.