org.mule.extras.acegi.AcegiSecurityContextFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mule-module-acegi Show documentation
Show all versions of mule-module-acegi Show documentation
Mule Acegi Support exposes Acegi Authentication providers and Method interceptors to authentication
event traffic via endpoints and method level authorisation on components.
/*
* $Id: AcegiSecurityContextFactory.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.mule.umo.security.UMOSecurityContextFactory;
import org.acegisecurity.context.SecurityContext;
import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.context.SecurityContextImpl;
/**
* AcegiSecurityContextFactory
creates an AcegiSecurityContext for an
* UMOAuthentication object
*/
public class AcegiSecurityContextFactory implements UMOSecurityContextFactory
{
public UMOSecurityContext create(UMOAuthentication authentication)
{
SecurityContext context = new SecurityContextImpl();
context.setAuthentication(((AcegiAuthenticationAdapter)authentication).getDelegate());
if (authentication.getProperties() != null)
{
if ((authentication.getProperties().containsKey("securityMode")))
{
SecurityContextHolder.setStrategyName((String)authentication.getProperties().get(
"securityMode"));
}
}
SecurityContextHolder.setContext(context);
return new AcegiSecurityContext(context);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy