01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 1999-2004 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: *
21: */package org.objectweb.jonas.security.interceptors.iiop;
22:
23: import org.omg.CORBA.LocalObject;
24:
25: import org.objectweb.security.context.Marshalling;
26: import org.objectweb.security.context.SecurityContext;
27:
28: /**
29: * Marshall/Unmarshall security context
30: * @author Guillaume Riviere (initial developer)
31: * @author Florent Benoit
32: */
33: public abstract class SecurityInterceptor extends LocalObject {
34:
35: /**
36: * security context id
37: */
38: public static final int SEC_CTX_ID = 101;
39:
40: /**
41: * Custom UTF8 marshalling SecurityContext
42: * The resulting bute array is composed of the following elements:
43: * principal-name, roles-number, role1, ...., runas-number, runas1, ....
44: * @return byte [] the marshalled context
45: * @param ctx SecurityContext
46: */
47: public byte[] marshallSecurityContext(SecurityContext ctx) {
48: return Marshalling.marshallSecurityContext(ctx);
49: }
50:
51: /**
52: * Custom UTF8 marshalling SecurityContext
53: * @param byteCtx the marshalled context
54: * @return SecurityContext
55: */
56: public SecurityContext unmarshallSecurityContext(byte[] byteCtx) {
57: return Marshalling.unmarshallSecurityContext(byteCtx);
58: }
59:
60: /**
61: * Return string representation of a security context
62: * @param scx given security context
63: * @return string representation of a security context
64: */
65: public String contextString(SecurityContext scx) {
66: return (scx.toString());
67: }
68:
69: }
|