1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
16 * The Original Code is Mozilla Communicator client code, released
19 * The Initial Developer of the Original Code is
20 * Netscape Communications Corporation.
21 * Portions created by the Initial Developer are Copyright (C) 1998
22 * the Initial Developer. All Rights Reserved.
26 * Alternatively, the contents of this file may be used under the terms of
27 * either of the GNU General Public License Version 2 or later (the "GPL"),
28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
40 * This file is part of the Java-vendor-neutral implementation of LiveConnect
42 * It contains the public XP-COM based interface for java to javascript communication.
43 * This interface allows java and javascript to exchange security contexts to allow
44 * access to restricted resources on either side.
48 #ifndef nsISecurityContext_h___
49 #define nsISecurityContext_h___
51 #include "nsISupports.h"
53 #define NS_ISECURITYCONTEXT_IID \
54 { /* {209B1120-4C41-11d2-A1CB-00805F8F694D} */ \
58 { 0xa1, 0xcb, 0x0, 0x80, 0x5f, 0x8f, 0x69, 0x4d } \
61 class nsISecurityContext
: public nsISupports
{
64 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISECURITYCONTEXT_IID
)
67 * Get the security context to be used in LiveConnect.
68 * This is used for JavaScript <--> Java.
70 * @param target -- Possible target.
71 * @param action -- Possible action on the target.
72 * @return -- NS_OK if the target and action is permitted on the security context.
73 * -- NS_FALSE otherwise.
75 NS_IMETHOD
Implies(const char* target
, const char* action
, PRBool
*bAllowedAccess
) = 0;
78 * Get the origin associated with the context.
80 * @param buf -- Result buffer (managed by the caller.)
81 * @param len -- Buffer length.
82 * @return -- NS_OK if the codebase string was obtained.
83 * -- NS_FALSE otherwise.
85 NS_IMETHOD
GetOrigin(char* buf
, int len
) = 0;
88 * Get the certificate associated with the context.
90 * @param buf -- Result buffer (managed by the caller.)
91 * @param len -- Buffer length.
92 * @return -- NS_OK if the codebase string was obtained.
93 * -- NS_FALSE otherwise.
95 NS_IMETHOD
GetCertificateID(char* buf
, int len
) = 0;
98 NS_DEFINE_STATIC_IID_ACCESSOR(nsISecurityContext
, NS_ISECURITYCONTEXT_IID
)
100 // Supported targets in Netscape Navigator 4.0 (Communicator):
102 #define nsSecurityTarget_UniversalThreadAccess "UniversalThreadAccess" // allows manipulation of threads not belonging to the applet
103 #define nsSecurityTarget_UniversalExecAccess "UniversalExecAccess" // allows executing sub-processes
104 #define nsSecurityTarget_UniversalExitAccess "UniversalExitAccess" // allows terminating the browser session
105 #define nsSecurityTarget_UniversalLinkAccess "UniversalLinkAccess" // allows linking to dymanically loaded libraries (DLLs)
106 #define nsSecurityTarget_UniversalPropertyWrite "UniversalPropertyWrite" // allows reading and writing of all system properties (vs. restrictions on applets)
107 #define nsSecurityTarget_UniversalPropertyRead "UniversalPropertyRead" // allows reading of all system properties (vs. restrictions on applets)
108 #define nsSecurityTarget_UniversalFileRead "UniversalFileRead" // allows reading any file in the local filesystem
109 #define nsSecurityTarget_UniversalFileWrite "UniversalFileWrite" // allows writing any file in the local filesystem
110 #define nsSecurityTarget_UniversalFileDelete "UniversalFileDelete" // allows deleting of any file in the local filesystem
111 #define nsSecurityTarget_UniversalFdRead "UniversalFdRead" // allows reading from any arbitrary file descriptor
112 #define nsSecurityTarget_UniversalFdWrite "UniversalFdWrite" // allows writing to any arbitrary file descriptor
113 #define nsSecurityTarget_UniversalListen "UniversalListen" // allows establishing the server-side of a network connection
114 #define nsSecurityTarget_UniversalAccept "UniversalAccept" // allows waiting on a network connection
115 #define nsSecurityTarget_UniversalConnect "UniversalConnect" // allows establishing the client-side of a network connection
116 #define nsSecurityTarget_UniversalMulticast "UniversalMulticast" // allows establishing IP multicast a network connection
117 #define nsSecurityTarget_UniversalTopLevelWindow "UniversalTopLevelWindow" // allows top-level windows to be created by the applet writer.
118 #define nsSecurityTarget_UniversalPackageAccess "UniversalPackageAccess" // allows access to java packages
119 #define nsSecurityTarget_UniversalPackageDefinition "UniversalPackageDefinition" // allows access to define packages
120 #define nsSecurityTarget_UniversalSetFactory "UniversalSetFactory" // allows access to set a networking-related object factory
121 #define nsSecurityTarget_UniversalMemberAccess "UniversalMemberAccess" // allows access to members of a class
122 #define nsSecurityTarget_UniversalPrintJobAccess "UniversalPrintJobAccess" // allows access to initiate a print job request
123 #define nsSecurityTarget_UniversalSystemClipboardAccess "UniversalSystemClipboardAccess" // allows access to System Clipboard
124 #define nsSecurityTarget_UniversalAwtEventQueueAccess "UniversalAwtEventQueueAccess" // allows access to Awt's EventQueue
125 #define nsSecurityTarget_UniversalSecurityProvider "UniversalSecurityProvider" // allows access to certain operations to a given provider, for example, only a given provider (e.g. Netscape) is able to retrieve the Netscape provider properties
126 #define nsSecurityTarget_UniversalBrowserRead "UniversalBrowserRead" // allows access to browser data
127 #define nsSecurityTarget_UniversalBrowserWrite "UniversalBrowserWrite" // allows modification of browser data
128 #define nsSecurityTarget_UniversalSendMail "UniversalSendMail" // allows sending mail
129 #define nsSecurityTarget_SuperUser "SuperUser" // enables all privileges
130 #define nsSecurityTarget_30Capabilities "30Capabilities" // enables all privileges that are available in Navigator 3.0.
131 #define nsSecurityTarget_UniversalFileAccess "UniversalFileAccess" // enables read, write and delete of any file in the local filesystem
132 #define nsSecurityTarget_TerminalEmulator "TerminalEmulator" // enables socket connections, property read and to link dynamic libraries.
136 #endif // nsISecurityContext_h___