Package org.nxplanner.security

Examples of org.nxplanner.security.AuthenticationException


    public void populateSubjectPrincipalFromDatabase(Subject subject, String userId)
            throws AuthenticationException {
        Person person = getPerson(userId);
        if (person == null) {
            throw new AuthenticationException("user " + userId + " not found");
        }
        subject.getPrincipals().add(new PersonPrincipal(person));

    }
View Full Code Here


            } else {
                return null;
            }
        } catch (Exception ex) {
            log.error("error during authentication", ex);
            throw new AuthenticationException("server error.");
        }

    }
View Full Code Here

                sharedState, options);
        try {
            if (jaasLoginModule.login()) {
                jaasLoginModule.commit();
            } else {
                throw new AuthenticationException("login failed");
            }
        } catch (FailedLoginException e) {
            throw new AuthenticationException(e);
        } catch (LoginException e) {
            log.error("login error", e);
            throw new AuthenticationException(e);
        }
        Set principals = subject.getPrincipals(jaasUserPrincipalClass);
        Iterator principalIterator = principals.iterator();
        if (principalIterator.hasNext()) {
            Principal jaasUserPrincipal = (Principal)principalIterator.next();
View Full Code Here

    }

    public Subject authenticate(String userId, String password) throws org.nxplanner.security.AuthenticationException {
        Subject subject = realmAuthenticate(userId, password);
        if (subject == null) {
            throw new AuthenticationException("authentication failed");
        }
        return subject;
    }
View Full Code Here

            DomainData data = (DomainData)dataClass.newInstance();
            if (hasPermission(getProjectId(object), object, "read")) {
                populateDomainData(data, object);
                return data;
            } else {
                throw new AuthenticationException("no permission to read object");
            }
        } catch (net.sf.hibernate.ObjectNotFoundException ex) {
            return null;
        } catch (Exception ex) {
            log.error("error loading objects", ex);
View Full Code Here

                    populateDomainObject(object, data);
                }
                saveHistory(session, object, HistoricalEvent.UPDATED);
                commit(session);
            } else {
                throw new AuthenticationException("no permission to update object");
            }
        } catch (Exception ex) {
            rollback(session);
            throw ex;
        }
View Full Code Here

            if (hasPermission(getProjectId(object), (DomainObject)object, "delete")) {
                session.delete(object);
                saveHistory(session, object, HistoricalEvent.DELETED);
                commit(session);
            } else {
                throw new AuthenticationException("no permission to delete object");
            }
        } catch (net.sf.hibernate.ObjectNotFoundException ex) {
            throw ex;
        } catch (Exception ex) {
            rollback(session);
View Full Code Here

                Serializable id = session.save(object);
                saveHistory(session, object, HistoricalEvent.CREATED);
                commit(session);
                return getObject(data.getClass(), ((Integer)id).intValue());
            } else {
                throw new AuthenticationException("no permission to create object");
            }
        } catch (Exception ex) {
            rollback(session);
            throw ex;
        }
View Full Code Here

                if (person != null) {
                    HashSet principals = new HashSet();
                    principals.add(new PersonPrincipal(person));
                    return new Subject(false, principals, new HashSet(), new HashSet());
                }
                throw new AuthenticationException("no such user in xplanner");
            } catch (AuthenticationException ex) {
                throw ex;
            } catch (Exception ex) {
                log.error("error during authentication", ex);
                throw new AuthenticationException("server error.");
            }
        } catch (AuthenticationException ex) {
            throw ex;
        } catch (Exception e) {
            log.error("error", e);
            throw new AuthenticationException("server error.");
        }
    }
View Full Code Here

                        HashSet principals = new HashSet();
                        principals.add(new PersonPrincipal(person));
                        return new Subject(false, principals, new HashSet(), new HashSet());
                    }
                }
                throw new AuthenticationException("Invalid login.");
            } catch (AuthenticationException ex) {
                throw ex;
            } catch (Exception ex) {
                log.error("error during authentication", ex);
                throw new AuthenticationException("server error.");
            }
        } catch (AuthenticationException ex) {
            throw ex;
        } catch (Exception e) {
            log.error("error", e);
            throw new AuthenticationException("server error.");
        }
    }
View Full Code Here

TOP

Related Classes of org.nxplanner.security.AuthenticationException

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.