ContextPermission (Java Card API, Connected Edition)
Date: 2009-12-11

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javacardx.framework
Class ContextPermission

    java.lang.Object
      java.security.Permission
          javacardx.security.URIPermission
              javacardx.framework.ContextPermission

    @TransactionType(value=NOT_SUPPORTED)
    public final class ContextPermission

extends URIPermission

This class is for firewall-enforced context permissions. The ContextPermission extends the URIPermission and defines specific actions. A ContextPermission consists of a URI and a set of actions valid for that URI.

The URI of a ContextPermission may designate an application or a protection domain. Additionally, in order to designate applications which register standard services without specifically naming these applications, the URI of a ContextPermission may designate applications using a service URI such as `sio:///standard/auth/*` (note that standard event URIs cannot be used).

The URI of a ContextPermission may designate:

- an application using an exact application or service URI pattern (one not ending with "/*"), such as `///transit/pos` or `sio:///standard/auth/holder/global/owner/pin`.

- a collection of applications using a path-prefix application or service URI pattern (one ending with "/*"), such as `///transit/*` or `sio:///standard/auth/*`.

- a protection domain using an opaque URI using the ad-hocly defined "pd" URI scheme, such as `pd:Classic`.

The actions to be granted are passed to the constructor in a string containing a list of one or more comma-separated keywords. The possible keywords are "switch", and "transfer". Their meaning is defined as follows:

switch
  context switch permission. Allows an application to call an SIO of an application in another context hence switching to the other application's context.
transfer
  ownership transfer permission. Allows an application to transfer the ownership of an object that it owns to another application hence allowing the other application to access the object once it is given a reference to it - typically through a call or return from a call to an SIO of one of the applications.

The actions string is converted to lowercase before processing.

Since:
  Java Card 3.0
See Also:
  `URIPermission`, `Permission`, `AccessController`, `AccessControlException`

Field Summary
`static String` | `ACTION_SWITCH` The "switch" action.
`static String` | `ACTION_TRANSFER` The "transfer" action.

Constructor Summary
`ContextPermission(String uri, String actions)` Creates a new ContextPermission object with the specified actions.

Method Summary
`protected String[]` | `getPossibleActions()` Returns the possible actions in the following order: switch, transfer.

Methods inherited from class javacardx.security.URIPermission
`equals, getActions, hashCode, implies`

Methods inherited from class java.security.Permission
`getName, toString`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### ACTION_SWITCH

    public static final String ACTION_SWITCH

  The "switch" action.

  See Also:
    Constant Field Values

### ACTION_TRANSFER

    public static final String ACTION_TRANSFER

  The "transfer" action.

  See Also:
    Constant Field Values

Constructor Detail

### ContextPermission

    public ContextPermission(String uri,
                             String actions)

  Creates a new ContextPermission object with the specified actions.

  uri identifies one of the following:

  - an application via the URI of that application, or the URI of that application's service
  - a protection domain via the URI of that protection domain
  actions contains a comma-separated list of the desired actions granted on the designated application or protection domain. Possible actions are "switch", and "transfer".

  A URI that ends in "/*" is a path-prefix pattern. It designates the root of a namespace which includes all resources within its scope.

  If the URI has a "pd:" scheme, it is interpreted as an opaque URI designating a protection domain. Otherwise, if the URI is an absolute hierarchical URI, it must designate a service. Otherwise, if the URI is a relative hierarchical URI, it is interpreted as a URI designating an application.

  A hierarchical URI with a relative path is resolved relatively to the current application's URI. The application URI `admin` would be resolved to `///transit/admin` in the context of the application's `///transit/pos`. A URI consisting of a single "*" is resolved relatively to the current application's URI. In the previous example, it would be resolved to `///transit/*`.

  A URI consisting of a "/*" designates all applications.

  Parameters:
    `uri` - an exact or path-prefix URI pattern designating a set of applications, services, or a protection domain.
    `actions` - the action string.
  Throws:
    `NullPointerException` - if `uri` or `actions` is `null`.
    `IllegalArgumentException` -
    - if `uri` is not a well-formed application, service or protection domain URI
    - or, if `actions` is empty or contains an action other than the specified possible actions.
    `SecurityException` - if `uri` or `actions` is not accessible in the caller's context.

Method Detail

### getPossibleActions

    protected String[] getPossibleActions()

  Returns the possible actions in the following order: switch, transfer.

  Note: this method returns a different array (a defensive copy) upon each call in order to guarantee the immutability of this permission object.

  Overrides:
    `getPossibleActions` in class `URIPermission`
  Returns:
    an array with all possible actions.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.