Coverage Report - org.mule.module.spring.security.SpringSecurityContext
 
Classes in this File Line Coverage Branch Coverage Complexity
SpringSecurityContext
0%
0/9
N/A
1
 
 1  
 /*
 2  
  * $Id: SpringSecurityContext.java 20477 2010-12-06 23:38:52Z mike.schilling $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.module.spring.security;
 12  
 
 13  
 import org.mule.api.security.Authentication;
 14  
 import org.mule.api.security.SecurityContext;
 15  
 
 16  
 import org.springframework.security.core.context.SecurityContextHolder;
 17  
 
 18  
 
 19  
 /**
 20  
  * <code>AcegiSecurityContext</code> is a SecurityContext wrapper used to
 21  
  * interface with an Acegi SecurityContext
 22  
  */
 23  
 
 24  
 public class SpringSecurityContext implements SecurityContext
 25  
 {
 26  
     private org.springframework.security.core.context.SecurityContext delegate;
 27  
     private SpringAuthenticationAdapter authentication;
 28  
 
 29  
     public SpringSecurityContext(org.springframework.security.core.context.SecurityContext delegate)
 30  
     
 31  0
     {
 32  0
         this.delegate = delegate;
 33  0
         SecurityContextHolder.setContext(this.delegate);
 34  0
     }
 35  
 
 36  
     public void setAuthentication(Authentication authentication)
 37  
     {
 38  0
         this.authentication = ((SpringAuthenticationAdapter)authentication);
 39  0
         delegate.setAuthentication(this.authentication.getDelegate());
 40  0
         SecurityContextHolder.setContext(delegate);
 41  0
     }
 42  
 
 43  
     public Authentication getAuthentication()
 44  
     {
 45  0
         return this.authentication;
 46  
     }
 47  
 }