All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mule.extras.acegi.AcegiSecurityContext Maven / Gradle / Ivy

Go to download

Mule Acegi Support exposes Acegi Authentication providers and Method interceptors to authentication event traffic via endpoints and method level authorisation on components.

There is a newer version: 3.1.2
Show newest version
/*
 * $Id: AcegiSecurityContext.java 7976 2007-08-21 14:26:13Z dirk.olmes $
 * --------------------------------------------------------------------------------------
 * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 *
 * The software in this package is published under the terms of the CPAL v1.0
 * license, a copy of which has been included with this distribution in the
 * LICENSE.txt file.
 */

package org.mule.extras.acegi;

import org.mule.umo.security.UMOAuthentication;
import org.mule.umo.security.UMOSecurityContext;

import org.acegisecurity.context.SecurityContext;
import org.acegisecurity.context.SecurityContextHolder;

/**
 * AcegiSecurityContext is a UMOSecurityContext wrapper used to
 * interface with an Acegi SecurityContext
 */

public class AcegiSecurityContext implements UMOSecurityContext
{
    private SecurityContext delegate;
    private AcegiAuthenticationAdapter authentication;

    public AcegiSecurityContext(SecurityContext delegate)
    {
        this.delegate = delegate;
        SecurityContextHolder.setContext(this.delegate);
    }

    public void setAuthentication(UMOAuthentication authentication)
    {
        this.authentication = ((AcegiAuthenticationAdapter)authentication);
        delegate.setAuthentication(this.authentication.getDelegate());
        SecurityContextHolder.setContext(delegate);
    }

    public UMOAuthentication getAuthentication()
    {
        return this.authentication;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy