/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Configuration source file for activatable SSL server */ import com.sun.jini.config.KeyStores; import com.sun.jini.example.hello.ServerPermission; import java.rmi.activation.ActivationID; import java.security.Permission; import java.util.Collections; import javax.security.auth.login.LoginContext; import net.jini.activation.*; import net.jini.constraint.*; import net.jini.core.constraint.*; import net.jini.discovery.LookupDiscovery; import net.jini.jeri.*; import net.jini.jeri.ssl.*; import net.jini.security.*; com.sun.jini.example.hello.Server { /* JAAS login */ loginContext = new LoginContext("com.sun.jini.example.hello.Server"); /* Public Key Certificates */ private static users = KeyStores.getKeyStore("file:prebuiltkeys/truststore", null); private static reggieUser = Collections.singleton( KeyStores.getX500Principal("reggie", users)); private static serverUser = Collections.singleton( KeyStores.getX500Principal("server", users)); private static phoenixUser = Collections.singleton( KeyStores.getX500Principal("phoenix", users)); /* Exporter for the server proxy */ exporter = /* Use activation exporter */ new ActivationExporter( (ActivationID) $data, /* Use secure exporter */ new BasicJeriExporter( /* Use SSL transport */ SslServerEndpoint.getInstance(0), /* Support ProxyTrust */ new ProxyTrustILFactory( /* Require integrity for all methods */ new BasicMethodConstraints( new InvocationConstraints(Integrity.YES, null)), /* Require ServerPermission */ ServerPermission.class))); /* Constraints for talking to Phoenix */ private static activationSystemConstraints = new BasicMethodConstraints( new InvocationConstraints( new InvocationConstraint[] { Integrity.YES, ClientAuthentication.NO, ServerAuthentication.YES, new ServerMinPrincipal(phoenixUser) }, null)); /* Proxy preparer for the activation ID */ activationIdPreparer = new BasicProxyPreparer( false, /* No need to verify the proxy */ activationSystemConstraints, null); private groups = new String[] { "ssl.hello.example.jini.sun.com" }; discoveryManager = new LookupDiscovery(groups, this); }// end com.sun.jini.example.hello.Server /* Configuration block for the lookup discovery utility */ net.jini.discovery.LookupDiscovery { private serviceLookupConstraints = new BasicMethodConstraints( new InvocationConstraints( new InvocationConstraint[]{ Integrity.YES, ClientAuthentication.YES, ServerAuthentication.YES, new ServerMinPrincipal( com.sun.jini.example.hello.Server.reggieUser) }, null)); static registrarPreparer = new BasicProxyPreparer( true, serviceLookupConstraints, new Permission[] { new AuthenticationPermission( com.sun.jini.example.hello.Server.serverUser, com.sun.jini.example.hello.Server.reggieUser, "connect") }); }//end net.jini.discovery.LookupDiscovery /* Configuration block for the join manager */ net.jini.lookup.JoinManager { static registrarPreparer = net.jini.discovery.LookupDiscovery.registrarPreparer; static registrationPreparer = net.jini.discovery.LookupDiscovery.registrarPreparer; static serviceLeasePreparer = net.jini.discovery.LookupDiscovery.registrarPreparer; }//end net.jini.lookup.JoinManager