Examples of UnauthorisedException


Examples of org.mule.api.security.UnauthorisedException

        SecurityProviderNotFoundException, EncryptionStrategyNotFoundException, InitialisationException
    {
        Authentication auth = event.getSession().getSecurityContext().getAuthentication();
        if (auth == null)
        {
            throw new UnauthorisedException(CoreMessages.authNoCredentials());
        }

        if (!(auth instanceof SpringAuthenticationAdapter))
        {
            throw new UnauthorisedException(SpringSecurityMessages.springAuthenticationRequired());
        }

        SpringAuthenticationAdapter springAuth = (SpringAuthenticationAdapter) auth;

        String principalName = springAuth.getName();
View Full Code Here

Examples of org.mule.api.security.UnauthorisedException

            loginContext.login();
        }
        catch (LoginException le)
        {
            le.fillInStackTrace();
            throw new UnauthorisedException(CoreMessages.authFailedForUser(auth.getPrincipal()));
        }

        Subject subject = loginContext.getSubject();
        JaasAuthentication finalAuth = new JaasAuthentication(auth.getPrincipal(), auth.getCredentials(),subject);
        finalAuth.setAuthenticated(true);
View Full Code Here

Examples of org.mule.api.security.UnauthorisedException

        HttpBasicAuthenticationFilter filter = new HttpBasicAuthenticationFilter();

        SecurityManager manager = mock(SecurityManager.class);
        filter.setSecurityManager(manager);

        doThrow(new UnauthorisedException(null, (MuleEvent) null)).when(manager).authenticate(
            (Authentication) anyObject());

        try
        {
            filter.authenticateInbound(event);
View Full Code Here

Examples of org.mule.api.security.UnauthorisedException

            if (logger.isDebugEnabled())
            {
                logger.debug("Authentication request for user: " + user.getUsername()
                    + " failed: " + e.toString());
            }
            throw new UnauthorisedException(
                CoreMessages.authFailedForUser(user.getUsername()), event, e);
        }

        // Authentication success
        if (logger.isDebugEnabled())
View Full Code Here

Examples of org.mule.api.security.UnauthorisedException

        SecurityContext securityContext = event.getSession().getSecurityContext();
        if (securityContext == null)
        {
            if (isAuthenticate())
            {
                throw new UnauthorisedException(event, securityContext, this);
            }
            else
            {
                return;
            }
View Full Code Here

Examples of org.mule.api.security.UnauthorisedException

    {

        public TestSecurityEvent(MuleContext muleContext) throws Exception
        {
            super(
                new UnauthorisedException(CoreMessages.createStaticMessage("dummy"), new DefaultMuleEvent(
                    new DefaultMuleMessage(NullPayload.getInstance(), muleContext), MessageExchangePattern.REQUEST_RESPONSE,
                    getTestService(), getTestSession(null, muleContext))), 0);
        }
View Full Code Here

Examples of org.mule.api.security.UnauthorisedException

        throws SecurityException, CryptoFailureException, SecurityProviderNotFoundException,
        EncryptionStrategyNotFoundException, UnknownAuthenticationTypeException
    {
        if (!isValid(event))
        {
            throw new UnauthorisedException(CoreMessages.authFailedForUser("a"));
        }
    }
View Full Code Here

Examples of org.mule.api.security.UnauthorisedException

    protected void authenticateOutbound(MuleEvent event)
        throws SecurityException, SecurityProviderNotFoundException, CryptoFailureException
    {
        if (!isValid(event))
        {
            throw new UnauthorisedException(CoreMessages.authFailedForUser("a"));
        }
    }
View Full Code Here

Examples of org.mule.api.security.UnauthorisedException

        {
            Map<?, ?> payload = event.getMessage().getPayload(DataTypeFactory.create(Map.class));
            String user = (String) payload.get("user");
            if (user == null)
            {
                throw new UnauthorisedException(CoreMessages.authNoCredentials(), event);
            }
            if ("anonymous".equals(user))
            {
                throw new UnauthorisedException(CoreMessages.authFailedForUser("anonymous"), event);
            }
        }
        catch (TransformerException te)
        {
            throw new UnauthorisedException(CoreMessages.transformFailed("Object", "Map"), event, te);
        }
    }
View Full Code Here

Examples of org.mule.api.security.UnauthorisedException

                if (logger.isDebugEnabled())
                {
                    logger.debug("Authentication request for user: " + username + " failed: " + e.toString());
                }
                setUnauthenticated(event);
                throw new UnauthorisedException(CoreMessages.authFailedForUser(username), e);
            }

            // Authentication success
            if (logger.isDebugEnabled())
            {
                logger.debug("Authentication success: " + authResult.toString());
            }

            SecurityContext context = getSecurityManager().createSecurityContext(authResult);
            context.setAuthentication(authResult);
            event.getSession().setSecurityContext(context);
        }
        else if (header == null)
        {
            setUnauthenticated(event);
            throw new UnauthorisedException(event, event.getSession().getSecurityContext(), this);
        }
        else
        {
            setUnauthenticated(event);
            throw new UnsupportedAuthenticationSchemeException(
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.