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