1 10 11 package org.mule.umo.security; 12 13 import org.mule.config.i18n.Message; 14 import org.mule.config.i18n.Messages; 15 import org.mule.impl.RequestContext; 16 import org.mule.umo.UMOMessage; 17 import org.mule.umo.endpoint.UMOImmutableEndpoint; 18 19 25 26 public class UnauthorisedException extends SecurityException 27 { 28 31 private static final long serialVersionUID = -6664384216189042672L; 32 33 public UnauthorisedException(Message message) 34 { 35 super(message, RequestContext.getEventContext().getMessage()); 36 } 37 38 public UnauthorisedException(Message message, Throwable cause) 39 { 40 super(message, RequestContext.getEventContext().getMessage(), cause); 41 } 42 43 public UnauthorisedException(Message message, UMOMessage umoMessage) 44 { 45 super(message, umoMessage); 46 } 47 48 public UnauthorisedException(Message message, UMOMessage umoMessage, Throwable cause) 49 { 50 super(message, umoMessage, cause); 51 } 52 53 public UnauthorisedException(UMOMessage umoMessage, 54 UMOSecurityContext context, 55 UMOImmutableEndpoint endpoint, 56 UMOEndpointSecurityFilter filter) 57 { 58 super(constructMessage(context, endpoint, filter), umoMessage); 59 } 60 61 private static Message constructMessage(UMOSecurityContext context, 62 UMOImmutableEndpoint endpoint, 63 UMOEndpointSecurityFilter filter) 64 { 65 66 Message m = null; 67 if (context == null) 68 { 69 m = new Message(Messages.AUTH_SET_TO_X_BUT_NO_CONTEXT, filter.getClass().getName()); 70 } 71 else 72 { 73 m = new Message(Messages.AUTH_FAILED_FOR_USER_X, context.getAuthentication().getPrincipal()); 74 } 75 m.setNextMessage(new Message(Messages.AUTH_DENIED_ON_ENDPOINT_X, endpoint.getEndpointURI())); 76 return m; 77 } 78 } 79 | Popular Tags |