public JAXWSProviderMethodDispatcher(JaxWsImplementorInfo implInfo) { try { invoke = ReflectionUtil.getMethod(implInfo.getImplementorClass(), "invoke", new Class[] {implInfo.getProviderParameterType()}); ReflectionUtil.setAccessible(invoke); } catch (Exception e1) { //fall back to the raw Provider provided invoke method try { invoke = Provider.class.getMethod("invoke", new Class[] {Object.class}); } catch (Exception e) { throw new ServiceConstructionException(e); } } }
if (JavaUtils.isJava9Compatible()) { try { Method m = ReflectionUtil.getMethod(Authenticator.class, "getDefault"); wrapped = (Authenticator)m.invoke(null); } catch (Exception e) { if (JavaUtils.isJava9Compatible()) { Class<?> methodHandles = Class.forName("java.lang.invoke.MethodHandles"); Method m = ReflectionUtil.getMethod(methodHandles, "lookup"); Object lookup = m.invoke(null); m = ReflectionUtil.getMethod(lookup.getClass(), "findClass", String.class); try { cls = (Class<?>)m.invoke(lookup, "org.apache.cxf.transport.http.ReferencingAuthenticator"); } catch (InvocationTargetException e) { m = ReflectionUtil.getMethod(lookup.getClass(), "defineClass", byte[].class); cls = (Class<?>)m.invoke(lookup, b);
protected boolean checkGroup(Principal principal, String role) { if (principal.getName().equals(role)) { return true; } Enumeration<? extends Principal> members = null; try { Method m = ReflectionUtil.getMethod(principal.getClass(), "members"); @SuppressWarnings("unchecked") Enumeration<? extends Principal> ms = (Enumeration<? extends Principal>)m.invoke(principal); members = ms; } catch (Exception e) { return false; } while (members.hasMoreElements()) { // this might be a plain role but could represent a group consisting of other groups/roles Principal member = members.nextElement(); if (member.getName().equals(role) || isGroupPrincipal(member) && checkGroup((GroupPrincipal)member, role)) { return true; } } return false; }
protected boolean checkGroup(Principal principal, String role) { if (principal.getName().equals(role)) { return true; } Enumeration<? extends Principal> members = null; try { Method m = ReflectionUtil.getMethod(principal.getClass(), "members"); @SuppressWarnings("unchecked") Enumeration<? extends Principal> ms = (Enumeration<? extends Principal>)m.invoke(principal); members = ms; } catch (Exception e) { return false; } while (members.hasMoreElements()) { // this might be a plain role but could represent a group consisting of other groups/roles Principal member = members.nextElement(); if (member.getName().equals(role) || isGroupPrincipal(member) && checkGroup((GroupPrincipal)member, role)) { return true; } } return false; }
public JAXWSProviderMethodDispatcher(JaxWsImplementorInfo implInfo) { try { invoke = ReflectionUtil.getMethod(implInfo.getImplementorClass(), "invoke", new Class[] {implInfo.getProviderParameterType()}); ReflectionUtil.setAccessible(invoke); } catch (Exception e1) { //fall back to the raw Provider provided invoke method try { invoke = Provider.class.getMethod("invoke", new Class[] {Object.class}); } catch (Exception e) { throw new ServiceConstructionException(e); } } }
if (JavaUtils.isJava9Compatible()) { try { Method m = ReflectionUtil.getMethod(Authenticator.class, "getDefault"); wrapped = (Authenticator)m.invoke(null); } catch (Exception e) { if (JavaUtils.isJava9Compatible()) { Class<?> methodHandles = Class.forName("java.lang.invoke.MethodHandles"); Method m = ReflectionUtil.getMethod(methodHandles, "lookup"); Object lookup = m.invoke(null); m = ReflectionUtil.getMethod(lookup.getClass(), "findClass", String.class); try { cls = (Class<?>)m.invoke(lookup, "org.apache.cxf.transport.http.ReferencingAuthenticator"); } catch (InvocationTargetException e) { m = ReflectionUtil.getMethod(lookup.getClass(), "defineClass", byte[].class); cls = (Class<?>)m.invoke(lookup, b);