/** * @param contextService * @param proxiedObject * @param executionProperties */ IdentityAwareProxyInvocationHandler(ContextServiceImpl contextService, Object proxiedObject, Map<String, String> executionProperties) { super(contextService, proxiedObject, executionProperties); SecurityDomain securityDomain = SecurityDomain.getCurrent(); securityIdentity = securityDomain != null ? securityDomain.getCurrentSecurityIdentity() : null; }
public DelegatingAuthConfigFactory(final ElytronAuthConfigFactory elytronAuthConfigFactory, final AuthConfigFactory backupAuthConfigFactory) { this(elytronAuthConfigFactory, backupAuthConfigFactory, () -> SecurityDomain.getCurrent() == null); }
private static SecurityIdentity getSecurityIdentity() { final SecurityManager sm = System.getSecurityManager(); final SecurityDomain securityDomain; if (sm != null) { securityDomain = AccessController.doPrivileged((PrivilegedAction<SecurityDomain>) () -> SecurityDomain.getCurrent()); } else { securityDomain = SecurityDomain.getCurrent(); } return securityDomain != null ? securityDomain.getCurrentSecurityIdentity() : null; }
private SecurityDomain getCurrentSecurityDomain() { if (WildFlySecurityManager.isChecking()) { return AccessController.doPrivileged((PrivilegedAction<SecurityDomain>) () -> SecurityDomain.getCurrent()); } else { return SecurityDomain.getCurrent(); } }
protected AbstractManagedThread createThread(final Runnable r, final ContextHandle contextHandleForSetup) { boolean checking = WildFlySecurityManager.isChecking(); SecurityDomain domain = checking ? AccessController.doPrivileged((PrivilegedAction<SecurityDomain>) SecurityDomain::getCurrent) : SecurityDomain.getCurrent(); SecurityIdentity identity = domain == null ? null : domain.getCurrentSecurityIdentity(); if (checking) { return AccessController.doPrivileged((PrivilegedAction<ElytronManagedThread>) () -> new ElytronManagedThread(r, contextHandleForSetup, identity) ); } else { return new ElytronManagedThread(r, contextHandleForSetup, identity); } }
/** {@inheritDoc} */ public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { final Interceptor interceptor = interceptors.get(method); if (interceptor == null) { throw new NoSuchMethodError(method.toString()); } final InterceptorContext context = new InterceptorContext(); // special location for original proxy context.putPrivateData(Object.class, proxy); context.putPrivateData(Component.class, componentView.getComponent()); context.putPrivateData(ComponentView.class, componentView); context.putPrivateData(SecurityDomain.class, WildFlySecurityManager.isChecking() ? AccessController.doPrivileged((PrivilegedAction<SecurityDomain>) SecurityDomain::getCurrent) : SecurityDomain.getCurrent()); instance.prepareInterceptorContext(context); context.setParameters(args); context.setMethod(method); // setup the public context data context.setContextData(new HashMap<String, Object>()); context.setBlockingCaller(true); return interceptor.processInvocation(context); } }
} else { securityContext = SecurityContextAssociation.getSecurityContext(); securityDomain = SecurityDomain.getCurrent();
public DelegatingAuthConfigFactory(final ElytronAuthConfigFactory elytronAuthConfigFactory, final AuthConfigFactory backupAuthConfigFactory) { this(elytronAuthConfigFactory, backupAuthConfigFactory, () -> SecurityDomain.getCurrent() == null); }
return; SecurityDomain domain = SecurityDomain.getCurrent(); SecurityIdentity currentIdentity = null; if(domain != null) {
public DelegatingAuthConfigFactory(final ElytronAuthConfigFactory elytronAuthConfigFactory, final AuthConfigFactory backupAuthConfigFactory) { this(elytronAuthConfigFactory, backupAuthConfigFactory, () -> SecurityDomain.getCurrent() == null); }
/** * @param contextService * @param proxiedObject * @param executionProperties */ IdentityAwareProxyInvocationHandler(ContextServiceImpl contextService, Object proxiedObject, Map<String, String> executionProperties) { super(contextService, proxiedObject, executionProperties); SecurityDomain securityDomain = SecurityDomain.getCurrent(); securityIdentity = securityDomain != null ? securityDomain.getCurrentSecurityIdentity() : null; }
private static void validateException(final Exception e, final boolean initialAuthSucceeded) { if (SecurityDomain.getCurrent() != null) { if (initialAuthSucceeded) { assertTrue("Expected EJBException due to bad password not thrown.", e instanceof EJBException && e.getCause() instanceof SecurityException); } else { assertTrue("Expected SecurityException due to bad password not thrown.", e instanceof SecurityException); } } else { assertTrue("Expected EJBAccessException due to bad password not thrown. (EJB 3.1 FR 17.6.9)", e instanceof EJBAccessException); } }
/** * @param contextService * @param proxiedObject * @param executionProperties */ IdentityAwareProxyInvocationHandler(ContextServiceImpl contextService, Object proxiedObject, Map<String, String> executionProperties) { super(contextService, proxiedObject, executionProperties); SecurityDomain securityDomain = SecurityDomain.getCurrent(); securityIdentity = securityDomain != null ? securityDomain.getCurrentSecurityIdentity() : null; }
/** {@inheritDoc} */ public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { final Interceptor interceptor = interceptors.get(method); if (interceptor == null) { throw new NoSuchMethodError(method.toString()); } final InterceptorContext context = new InterceptorContext(); // special location for original proxy context.putPrivateData(Object.class, proxy); context.putPrivateData(Component.class, componentView.getComponent()); context.putPrivateData(ComponentView.class, componentView); context.putPrivateData(SecurityDomain.class, WildFlySecurityManager.isChecking() ? AccessController.doPrivileged((PrivilegedAction<SecurityDomain>) SecurityDomain::getCurrent) : SecurityDomain.getCurrent()); instance.prepareInterceptorContext(context); context.setParameters(args); context.setMethod(method); // setup the public context data context.setContextData(new HashMap<String, Object>()); context.setBlockingCaller(true); return interceptor.processInvocation(context); } }
private static SecurityIdentity getSecurityIdentity() { final SecurityManager sm = System.getSecurityManager(); final SecurityDomain securityDomain; if (sm != null) { securityDomain = AccessController.doPrivileged((PrivilegedAction<SecurityDomain>) () -> SecurityDomain.getCurrent()); } else { securityDomain = SecurityDomain.getCurrent(); } return securityDomain != null ? securityDomain.getCurrentSecurityIdentity() : null; }
/** {@inheritDoc} */ public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { final Interceptor interceptor = interceptors.get(method); if (interceptor == null) { throw new NoSuchMethodError(method.toString()); } final InterceptorContext context = new InterceptorContext(); // special location for original proxy context.putPrivateData(Object.class, proxy); context.putPrivateData(Component.class, componentView.getComponent()); context.putPrivateData(ComponentView.class, componentView); context.putPrivateData(SecurityDomain.class, WildFlySecurityManager.isChecking() ? AccessController.doPrivileged((PrivilegedAction<SecurityDomain>) SecurityDomain::getCurrent) : SecurityDomain.getCurrent()); instance.prepareInterceptorContext(context); context.setParameters(args); context.setMethod(method); // setup the public context data context.setContextData(new HashMap<String, Object>()); context.setBlockingCaller(true); return interceptor.processInvocation(context); } }
private static SecurityIdentity getSecurityIdentity() { final SecurityManager sm = System.getSecurityManager(); final SecurityDomain securityDomain; if (sm != null) { securityDomain = AccessController.doPrivileged((PrivilegedAction<SecurityDomain>) () -> SecurityDomain.getCurrent()); } else { securityDomain = SecurityDomain.getCurrent(); } return securityDomain != null ? securityDomain.getCurrentSecurityIdentity() : null; }
protected AbstractManagedThread createThread(final Runnable r, final ContextHandle contextHandleForSetup) { boolean checking = WildFlySecurityManager.isChecking(); SecurityDomain domain = checking ? AccessController.doPrivileged((PrivilegedAction<SecurityDomain>) SecurityDomain::getCurrent) : SecurityDomain.getCurrent(); SecurityIdentity identity = domain == null ? null : domain.getCurrentSecurityIdentity(); if (checking) { return AccessController.doPrivileged((PrivilegedAction<ElytronManagedThread>) () -> new ElytronManagedThread(r, contextHandleForSetup, identity) ); } else { return new ElytronManagedThread(r, contextHandleForSetup, identity); } }
protected AbstractManagedThread createThread(final Runnable r, final ContextHandle contextHandleForSetup) { boolean checking = WildFlySecurityManager.isChecking(); SecurityDomain domain = checking ? AccessController.doPrivileged((PrivilegedAction<SecurityDomain>) SecurityDomain::getCurrent) : SecurityDomain.getCurrent(); SecurityIdentity identity = domain == null ? null : domain.getCurrentSecurityIdentity(); if (checking) { return AccessController.doPrivileged((PrivilegedAction<ElytronManagedThread>) () -> new ElytronManagedThread(r, contextHandleForSetup, identity) ); } else { return new ElytronManagedThread(r, contextHandleForSetup, identity); } }
final String password = req.getParameter(PARAM_PASSWORD); try { si = SecurityDomain.getCurrent().authenticate(user, new PasswordGuessEvidence(password.toCharArray())); } catch (Exception e) { e.printStackTrace(); si = SecurityDomain.getCurrent().getCurrentSecurityIdentity();