/** * Add dynamic {@link SocketPermission} based on transport settings. * * @param policy the {@link Permissions} instance to apply the dynamic {@link SocketPermission}s to * @param settings the {@link Settings} instance to read the transport settings from */ private static void addSocketPermissionForTransport(final Permissions policy, final Settings settings) { final String transportRange = TransportSettings.PORT.get(settings); addSocketPermissionForPortRange(policy, transportRange); }
/** * Add dynamic {@link SocketPermission} based on transport settings. This method will first check if there is a port range specified in * the transport profile specified by {@code profileSettings} and will fall back to {@code settings}. * * @param policy the {@link Permissions} instance to apply the dynamic {@link SocketPermission}s to * @param settings the {@link Settings} instance to read the transport settings from */ private static void addSocketPermissionForTransportProfiles(final Permissions policy, final Settings settings) { // transport is way over-engineered Set<TcpTransport.ProfileSettings> profiles = TcpTransport.getProfileSettings(settings); Set<String> uniquePortRanges = new HashSet<>(); // loop through all profiles and add permissions for each one for (final TcpTransport.ProfileSettings profile : profiles) { if (uniquePortRanges.add(profile.portOrRange)) { // profiles fall back to the transport.port if it's not explicit but we want to only add one permission per range addSocketPermissionForPortRange(policy, profile.portOrRange); } } }
/** * Add dynamic {@link SocketPermission} based on HTTP settings. * * @param policy the {@link Permissions} instance to apply the dynamic {@link SocketPermission}s to. * @param settings the {@link Settings} instance to read the HTTP settings from */ private static void addSocketPermissionForHttp(final Permissions policy, final Settings settings) { // http is simple final String httpRange = HttpTransportSettings.SETTING_HTTP_PORT.get(settings).getPortRangeString(); addSocketPermissionForPortRange(policy, httpRange); }
/** * Add dynamic {@link SocketPermission} based on transport settings. * * @param policy the {@link Permissions} instance to apply the dynamic {@link SocketPermission}s to * @param settings the {@link Settings} instance to read the transport settings from */ private static void addSocketPermissionForTransport(final Permissions policy, final Settings settings) { final String transportRange = TcpTransport.PORT.get(settings); addSocketPermissionForPortRange(policy, transportRange); }
/** * Add dynamic {@link SocketPermission} based on transport settings. * * @param policy the {@link Permissions} instance to apply the dynamic {@link SocketPermission}s to * @param settings the {@link Settings} instance to read the transport settings from */ private static void addSocketPermissionForTransport(final Permissions policy, final Settings settings) { final String transportRange = TransportSettings.PORT.get(settings); addSocketPermissionForPortRange(policy, transportRange); }
/** * Add dynamic {@link SocketPermission} based on transport settings. * * @param policy the {@link Permissions} instance to apply the dynamic {@link SocketPermission}s to * @param settings the {@link Settings} instance to read the transport settings from */ private static void addSocketPermissionForTransport(final Permissions policy, final Settings settings) { final String transportRange = TcpTransport.PORT.get(settings); addSocketPermissionForPortRange(policy, transportRange); }
/** * Add dynamic {@link SocketPermission} based on transport settings. This method will first check if there is a port range specified in * the transport profile specified by {@code profileSettings} and will fall back to {@code settings}. * * @param policy the {@link Permissions} instance to apply the dynamic {@link SocketPermission}s to * @param settings the {@link Settings} instance to read the transport settings from */ private static void addSocketPermissionForTransportProfiles(final Permissions policy, final Settings settings) { // transport is way over-engineered Set<TcpTransport.ProfileSettings> profiles = TcpTransport.getProfileSettings(settings); Set<String> uniquePortRanges = new HashSet<>(); // loop through all profiles and add permissions for each one for (final TcpTransport.ProfileSettings profile : profiles) { if (uniquePortRanges.add(profile.portOrRange)) { // profiles fall back to the transport.port if it's not explicit but we want to only add one permission per range addSocketPermissionForPortRange(policy, profile.portOrRange); } } }
/** * Add dynamic {@link SocketPermission} based on transport settings. This method will first check if there is a port range specified in * the transport profile specified by {@code profileSettings} and will fall back to {@code settings}. * * @param policy the {@link Permissions} instance to apply the dynamic {@link SocketPermission}s to * @param settings the {@link Settings} instance to read the transport settings from */ private static void addSocketPermissionForTransportProfiles(final Permissions policy, final Settings settings) { // transport is way over-engineered Set<TcpTransport.ProfileSettings> profiles = TcpTransport.getProfileSettings(settings); Set<String> uniquePortRanges = new HashSet<>(); // loop through all profiles and add permissions for each one for (final TcpTransport.ProfileSettings profile : profiles) { if (uniquePortRanges.add(profile.portOrRange)) { // profiles fall back to the transport.port if it's not explicit but we want to only add one permission per range addSocketPermissionForPortRange(policy, profile.portOrRange); } } }
/** * Add dynamic {@link SocketPermission} based on HTTP settings. * * @param policy the {@link Permissions} instance to apply the dynamic {@link SocketPermission}s to. * @param settings the {@link Settings} instance to read the HTTP settings from */ private static void addSocketPermissionForHttp(final Permissions policy, final Settings settings) { // http is simple final String httpRange = HttpTransportSettings.SETTING_HTTP_PORT.get(settings).getPortRangeString(); addSocketPermissionForPortRange(policy, httpRange); }
/** * Add dynamic {@link SocketPermission} based on HTTP settings. * * @param policy the {@link Permissions} instance to apply the dynamic {@link SocketPermission}s to. * @param settings the {@link Settings} instance to read the HTTP settingsfrom */ private static void addSocketPermissionForHttp(final Permissions policy, final Settings settings) { // http is simple final String httpRange = HttpTransportSettings.SETTING_HTTP_PORT.get(settings).getPortRangeString(); addSocketPermissionForPortRange(policy, httpRange); }
/** * Add dynamic {@link SocketPermission} based on HTTP settings. * * @param policy the {@link Permissions} instance to apply the dynamic {@link SocketPermission}s to. * @param settings the {@link Settings} instance to read the HTTP settings from */ private static void addSocketPermissionForHttp(final Permissions policy, final Settings settings) { // http is simple final String httpRange = HttpTransportSettings.SETTING_HTTP_PORT.get(settings).getPortRangeString(); addSocketPermissionForPortRange(policy, httpRange); }
final String transportRange = profileSettings.get("port"); if (transportRange != null) { addSocketPermissionForPortRange(policy, transportRange); } else { addSocketPermissionForTransport(policy, settings);