Examples of AuthenticationException


Examples of javax.naming.AuthenticationException

        AuthenticationResponse res = null;

        try {
            res = requestAuthorization(req);
        } catch (RemoteException e) {
            throw new AuthenticationException(e.getLocalizedMessage());
        }

        switch (res.getResponseCode()) {
            case ResponseCodes.AUTH_GRANTED:
                client = res.getIdentity();
                break;
            case ResponseCodes.AUTH_REDIRECT:
                client = res.getIdentity();
                server = res.getServer();
                break;
            case ResponseCodes.AUTH_DENIED:
                throw (AuthenticationException) new AuthenticationException("This principle is not authorized.").initCause(res.getDeniedCause());
        }
    }
View Full Code Here

Examples of javax.naming.AuthenticationException

                } else {
                    clientIdentity = securityService.login(realmName, user, pass);
                }
                ClientSecurity.setIdentity(clientIdentity);
            } catch (LoginException e) {
                throw (AuthenticationException) new AuthenticationException("User could not be authenticated: "+user).initCause(e);
            }
        }
    }
View Full Code Here

Examples of javax.naming.AuthenticationException

                } else {
                    identity = securityService.login(realmName, user, pass);
                }
                securityService.associate(identity);
            } catch (LoginException e) {
                throw (AuthenticationException) new AuthenticationException("User could not be authenticated: "+user).initCause(e);
            }
        }

        ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
        Context context = containerSystem.getJNDIContext();
View Full Code Here

Examples of javax.security.sasl.AuthenticationException

                           entry = realmMap.get(userName);
                        }
                     }
                  }
                  if (entry == null) {
                     throw new AuthenticationException("No matching user found");
                  }
                  for (String group : entry.getGroups()) {
                     subject.getPrincipals().add(new SimpleGroupPrincipal(group));
                  }
                  passwordCallback.setPassword(entry.getPassword());
View Full Code Here

Examples of jcifs.spnego.AuthenticationException

    return this.valid ? this.principal : null;
  }

  public void process(byte[] arg0) throws AuthenticationException {
    if (!this.valid)
      throw new AuthenticationException("not valid");
  }
View Full Code Here

Examples of me.victorhernandez.hellospring.exception.AuthenticationException

        .createQuery("from Usuario as p where p.nombre = :username and p.password = :password");
    query.setParameter("username", username);
    query.setParameter("password", password);
    results = query.getResultList();
    if (results == null || results.size() <= 0) {
      throw new AuthenticationException("No users found");
    } else {
      return results.get(0);
    }
  }
View Full Code Here

Examples of net.sf.archimede.security.AuthenticationException

        CredentialsWrapper cw = new CredentialsWrapper(this.username, this.password);
      
        try {
            if (this.username.equals(SystemPrincipal.getUsername())) {
                if (!cw.equals(SystemPrincipal.getCredentials())) {
                    throw new AuthenticationException("Wrong password");
                }
            } else if (!this.username.equals(AnonymousPrincipal.getUsername())) {
                //FIXME Tout le monde peut lire les comptes utilisateurs ??
               
                boolean exists = UserDao.createInstance().exists(this.username, this.password);
                //Warning, user is detached
                if (!exists) {
                    throw new AuthenticationException("Wrong username and/or password");
                }
            }
           
            HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
            request.getSession(true).setAttribute(SESSION_REF, this);           
View Full Code Here

Examples of nexj.core.util.auth.AuthenticationException

               s_logger.debug("Authentication error", e);
            }
         }
         else if (m_bSPNEGOStrict)
         {
            throw new AuthenticationException("err.auth.server");
         }

         m_authenticator.dispose();
         m_authenticator = null;
      }
View Full Code Here

Examples of org.acegisecurity.AuthenticationException

        throws AuthenticationException {
        Iterator iter = providers.iterator();

        Class toTest = authentication.getClass();

        AuthenticationException lastException = null;

        while (iter.hasNext()) {
            AuthenticationProvider provider = (AuthenticationProvider) iter.next();

            if (provider.supports(toTest)) {
                logger.debug("Authentication attempt using " + provider.getClass().getName());

                Authentication result = null;

                try {
                    result = provider.authenticate(authentication);
                    copyDetails(authentication, result);
                    sessionController.checkAuthenticationAllowed(result);
                } catch (AuthenticationException ae) {
                    lastException = ae;
                    result = null;
                }

                if (result != null) {
                    sessionController.registerSuccessfulAuthentication(result);
                    publishEvent(new AuthenticationSuccessEvent(result));

                    return result;
                }
            }
        }

        if (lastException == null) {
            lastException = new ProviderNotFoundException(messages.getMessage("ProviderManager.providerNotFound",
                        new Object[] {toTest.getName()}, "No AuthenticationProvider found for {0}"));
        }

        // Publish the event
        String className = exceptionMappings.getProperty(lastException.getClass().getName());
        AbstractAuthenticationEvent event = null;

        if (className != null) {
            try {
                Class clazz = getClass().getClassLoader().loadClass(className);
                Constructor constructor = clazz.getConstructor(new Class[] {
                            Authentication.class, AuthenticationException.class
                        });
                Object obj = constructor.newInstance(new Object[] {authentication, lastException});
                Assert.isInstanceOf(AbstractAuthenticationEvent.class, obj, "Must be an AbstractAuthenticationEvent");
                event = (AbstractAuthenticationEvent) obj;
            } catch (ClassNotFoundException ignored) {}
            catch (NoSuchMethodException ignored) {}
            catch (IllegalAccessException ignored) {}
            catch (InstantiationException ignored) {}
            catch (InvocationTargetException ignored) {}
        }

        if (event != null) {
            publishEvent(event);
        } else {
            if (logger.isDebugEnabled()) {
                logger.debug("No event was found for the exception " + lastException.getClass().getName());
            }
        }

        // Throw the exception
        throw lastException;
View Full Code Here

Examples of org.apache.airavata.security.AuthenticationException

    String getUserName(HttpServletRequest httpServletRequest) throws AuthenticationException {

        String basicHeader = httpServletRequest.getHeader(AUTHORISATION_HEADER_NAME);

        if (basicHeader == null) {
            throw new AuthenticationException("Authorization Required");
        }

        String[] userNamePasswordArray = basicHeader.split(" ");

        if (userNamePasswordArray == null || userNamePasswordArray.length != 2) {
            throw new AuthenticationException("Authorization Required");
        }

        String decodedString = decode(userNamePasswordArray[1]);

        String[] array = decodedString.split(":");

        if (array == null || array.length != 1) {
            throw new AuthenticationException("Authorization Required");
        }

        return array[0];

    }
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.