Skip to content

Instantly share code, notes, and snippets.

@christian-posta
Created June 20, 2014 20:09
Show Gist options
  • Save christian-posta/c61d3c257e007272bf7e to your computer and use it in GitHub Desktop.
Save christian-posta/c61d3c257e007272bf7e to your computer and use it in GitHub Desktop.
146 /**
147 * Eventually add the security subject that has created this event.
148 */
149 private void prepare(final Event event)
150 {
151 Subject subject = Subject.getSubject(AccessController.getContext());
152 if (subject != null)
153 {
154 try
155 {
156 Field f = Event.class.getDeclaredField("properties");
157 f.setAccessible(true);
158 Map props = (Map) f.get(event);
159 props.put("event.subject", subject);
160 }
161 catch (Throwable t)
162 {
163 // Ignore
164 }
165 }
166 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment