KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > security > interceptors > iiop > SecurityInterceptor


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999-2004 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * 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  */

22 package org.objectweb.jonas.security.interceptors.iiop;
23
24 import org.omg.CORBA.LocalObject JavaDoc;
25
26 import org.objectweb.security.context.Marshalling;
27 import org.objectweb.security.context.SecurityContext;
28
29 /**
30  * Marshall/Unmarshall security context
31  * @author Guillaume Riviere (initial developer)
32  * @author Florent Benoit
33  */

34 public abstract class SecurityInterceptor extends LocalObject JavaDoc {
35
36     /**
37      * security context id
38      */

39     public static final int SEC_CTX_ID = 101;
40
41     /**
42      * Custom UTF8 marshalling SecurityContext
43      * The resulting bute array is composed of the following elements:
44      * principal-name, roles-number, role1, ...., runas-number, runas1, ....
45      * @return byte [] the marshalled context
46      * @param ctx SecurityContext
47      */

48     public byte[] marshallSecurityContext(SecurityContext ctx) {
49         return Marshalling.marshallSecurityContext(ctx);
50     }
51
52     /**
53      * Custom UTF8 marshalling SecurityContext
54      * @param byteCtx the marshalled context
55      * @return SecurityContext
56      */

57     public SecurityContext unmarshallSecurityContext(byte[] byteCtx) {
58         return Marshalling.unmarshallSecurityContext(byteCtx);
59     }
60
61     /**
62      * Return string representation of a security context
63      * @param scx given security context
64      * @return string representation of a security context
65      */

66     public String JavaDoc contextString(SecurityContext scx) {
67         return (scx.toString());
68     }
69
70 }
71
72
Popular Tags