Package org.springframework.security.authentication.event

Examples of org.springframework.security.authentication.event.AbstractAuthenticationEvent


        }
    }

    public void publishAuthenticationFailure(AuthenticationException exception, Authentication authentication) {
        Constructor<? extends AbstractAuthenticationEvent> constructor = exceptionMappings.get(exception.getClass().getName());
        AbstractAuthenticationEvent event = null;

        if (constructor != null) {
            try {
                event = constructor.newInstance(authentication, exception);
            } catch (IllegalAccessException ignored) {}
View Full Code Here


        super.setUp();
    }

    public void testAbstractAuthenticationEvent() {
        Authentication auth = getAuthentication();
        AbstractAuthenticationEvent event = new AuthenticationSuccessEvent(auth);
        assertEquals(auth, event.getAuthentication());
    }
View Full Code Here

     * Depending on which type of app event we will log one or other thing.
     */
    public void onApplicationEvent(ApplicationEvent ev) {

        if (ev instanceof AbstractAuthenticationEvent) {
            AbstractAuthenticationEvent e = (AbstractAuthenticationEvent) ev;

            if (e instanceof InteractiveAuthenticationSuccessEvent
                    || e instanceof AuthenticationSuccessEvent
                    || e instanceof AuthenticationSwitchUserEvent) {

                try {
                    UserDetails userDetails = (UserDetails) e
                            .getAuthentication().getPrincipal();

                    User user = _userRepository.findOneByUsername(userDetails.getUsername());
                    user.setLastLoginDate(new ISODate().toString());
                    _userRepository.save(user);
View Full Code Here

    }

    public void publishAuthenticationFailure(AuthenticationException exception,
            Authentication authentication) {
        String className = exceptionMappings.getProperty(exception.getClass().getName());
        AbstractAuthenticationEvent event = null;

        if (className != null) {
            try {
                Class<?> clazz = getClass().getClassLoader().loadClass(className);
                Constructor<?> constructor = clazz.getConstructor(new Class[] {
View Full Code Here

TOP

Related Classes of org.springframework.security.authentication.event.AbstractAuthenticationEvent

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.