KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > iiop > security > ConnectionContext


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.iiop.security;
25
26 import java.io.*;
27 import java.net.Socket JavaDoc;
28
29 import com.sun.corba.ee.spi.ior.IOR;
30 import com.sun.corba.ee.spi.transport.SocketInfo;
31 import com.sun.corba.ee.org.omg.CSI.*;
32 import com.sun.corba.ee.org.omg.CSIIOP.*;
33
34
35 /**
36  * @author Vivek Nagar
37  */

38
39 public final class ConnectionContext implements Serializable {
40     private CompoundSecMech mechanism = null;
41     private boolean sslClientAuth = false;
42     private boolean ssl = false;
43     private IOR ior = null;
44     private Socket JavaDoc socket = null;
45     private SocketInfo endpoint = null;
46
47     /**
48      * Default constructor.
49      */

50     public ConnectionContext() {
51     }
52
53     /**
54      * Create the security mechanism context. This is stored in TLS.
55      */

56     public ConnectionContext(CompoundSecMech mech, IOR ior) {
57     this.ior = ior;
58     mechanism = mech;
59     }
60
61     /**
62      * Return the IOR.
63      */

64      public IOR getIOR() {
65     return ior;
66      }
67
68     /**
69      * Set the IOR
70      */

71     public void setIOR(IOR ior) {
72     this.ior = ior;
73     }
74
75     /**
76      * Return the selected compound security mechanism.
77      */

78     public CompoundSecMech getMechanism() {
79     return mechanism;
80     }
81
82     /**
83      * Set the mechanism used for this invocation.
84      */

85     public void setMechanism(CompoundSecMech mech) {
86     mechanism = mech;
87     }
88
89     /**
90      * Return true if SSL client authentication has happened, false otherwise.
91      */

92     public boolean getSSLClientAuthenticationOccurred() {
93     return sslClientAuth;
94     }
95
96     /**
97      * Set true if SSL client authentication has happened.
98      */

99     public void setSSLClientAuthenticationOccurred(boolean val) {
100     sslClientAuth = val;
101     }
102
103     /**
104      * Return true if SSL was used to invoke the EJB.
105      */

106     public boolean getSSLUsed() {
107     return ssl;
108     }
109
110     /**
111      * Set true if SSL was used to invoke the EJB.
112      */

113     public void setSSLUsed(boolean val) {
114     ssl = val;
115     }
116
117     public void setEndPointInfo(SocketInfo info) {
118     endpoint = info;
119     }
120
121     public SocketInfo getEndPointInfo() {
122     return endpoint;
123     }
124
125     /**
126      * Return the socket for this connection.
127      */

128     public Socket JavaDoc getSocket() {
129     return socket;
130     }
131
132     /**
133      * Set the socket for this connection.
134      */

135     public void setSocket(Socket JavaDoc s) {
136     socket = s;
137     }
138
139     public String JavaDoc toString() {
140     String JavaDoc s = "sslClientAuth=" + sslClientAuth;
141     s = s + " SSL=" + ssl;
142     s = s + " ENDPOINT=" + endpoint;
143     s = s + " mechanism=" + mechanism;
144     s = s + " IOR=" + ior;
145     s = s + " Socket=" + socket;
146     return s;
147     }
148 }
149
150
151
Popular Tags