| java.lang.Object com.sun.midp.security.SecurityHandler
SecurityHandler | final public class SecurityHandler (Code) | | Contains methods to handle with the various security state information of a
a MIDlet suite.
|
Field Summary | |
final public static String | STD_EX_MSG The standard security exception message. |
Constructor Summary | |
public | SecurityHandler(byte[] apiPermissions, String domain) Creates a security domain with a list of permitted actions or no list
to indicate all actions. | public | SecurityHandler(SecurityToken securityToken, byte[] apiPermissions, String domain) Creates a security domain with a list of permitted actions or no list
to indicate all actions. |
Method Summary | |
public static boolean | askUserForPermission(SecurityToken token, boolean trusted, int title, int question, String app, String resource, String extraValue) Ask the user yes/no permission question. | public boolean | checkForPermission(int permission, int title, int question, int oneshotQuestion, String app, String resource, String extraValue) Check for permission and throw an exception if not allowed.
May block to ask the user a question.
The title, and question strings will be translated,
if a string resource is available.
Since the strings can have substitution token in them, if there is a
"%" it must changed to "%%". | public boolean | checkForPermission(int permission, int title, int question, int oneShotQuestion, String app, String resource, String extraValue, String exceptionMsg) Check for permission and throw an exception if not allowed.
May block to ask the user a question.
The title, question, and answer strings will be translated,
if a string resource is available.
Since the strings can have substitution token in them, if there is a
"%" it must changed to "%%". | public int | checkPermission(String permission) Get the status of the specified permission.
If no API on the device defines the specific permission
requested then it must be reported as denied.
If the status of the permission is not known because it might
require a user interaction then it should be reported as unknown.
Parameters: permission - to check if denied, allowed, or unknown. | static void | initSecurityToken(SecurityToken token) Initializes the security token for this class, so it can
perform actions that a normal MIDlet Suite cannot. |
STD_EX_MSG | final public static String STD_EX_MSG(Code) | | The standard security exception message.
|
SecurityHandler | public SecurityHandler(byte[] apiPermissions, String domain)(Code) | | Creates a security domain with a list of permitted actions or no list
to indicate all actions. The caller must be have permission for
Permissions.MIDP or be the first caller of
the method for this instance of the VM.
Parameters: apiPermissions - for the token Parameters: domain - name of the security domain exception: SecurityException - if caller is not permitted to call thismethod |
SecurityHandler | public SecurityHandler(SecurityToken securityToken, byte[] apiPermissions, String domain)(Code) | | Creates a security domain with a list of permitted actions or no list
to indicate all actions. The caller must be have permission for
Permissions.MIDP or be the first caller of
the method for this instance of the VM.
Parameters: securityToken - security token of the caller Parameters: apiPermissions - for the token, can be null Parameters: domain - name of the security domain exception: SecurityException - if caller is not permitted to call thismethod |
askUserForPermission | public static boolean askUserForPermission(SecurityToken token, boolean trusted, int title, int question, String app, String resource, String extraValue) throws InterruptedException(Code) | | Ask the user yes/no permission question.
Parameters: token - security token with the permission to preempt theforeground display Parameters: trusted - true to display the trusted icon, false to display theuntrusted icon Parameters: title - Resource constant for the title of the dialog Parameters: question - Resource constant for the question to ask user Parameters: app - name of the application to insert into a stringcan be null if no %1 a string Parameters: resource - string to insert into a string,can be null if no %2 in a string Parameters: extraValue - string to insert into a string,can be null if no %3 in a string true if the user says yes else false exception: InterruptedException - if another thread interrupts thecalling thread while this method is waiting to preempt thedisplay. |
checkForPermission | public boolean checkForPermission(int permission, int title, int question, int oneshotQuestion, String app, String resource, String extraValue) throws InterruptedException(Code) | | Check for permission and throw an exception if not allowed.
May block to ask the user a question.
The title, and question strings will be translated,
if a string resource is available.
Since the strings can have substitution token in them, if there is a
"%" it must changed to "%%". If a string has a %1, the app parameter
will be substituted for it. If a string has a "%2, the resource
parameter will be substituted for it. If a string has a %3, the
extraValue parameter will be substituted for it.
Parameters: permission - ID of the permission to check for,the ID must be fromcom.sun.midp.security.Permissions Parameters: title - Resource constant for the title of the dialog Parameters: question - Resource constant for the question to ask the user Parameters: oneshotQuestion - Resource constant for the oneshot question toask the user Parameters: app - name of the application to insert into a stringcan be null if no %1 a string Parameters: resource - string to insert into a string,can be null if no %2 in a string Parameters: extraValue - string to insert into a string,can be null if no %3 in a string true if the permission interaction has permanentlychanged and the new state should be saved, this will only happenif the permission granted exception: SecurityException - if the permission is notallowed by this token exception: InterruptedException - if another thread interrupts thecalling thread while this method is waiting to preempt thedisplay. |
checkForPermission | public boolean checkForPermission(int permission, int title, int question, int oneShotQuestion, String app, String resource, String extraValue, String exceptionMsg) throws InterruptedException(Code) | | Check for permission and throw an exception if not allowed.
May block to ask the user a question.
The title, question, and answer strings will be translated,
if a string resource is available.
Since the strings can have substitution token in them, if there is a
"%" it must changed to "%%". If a string has a %1, the app parameter
will be substituted for it. If a string has a "%2, the resource
parameter will be substituted for it. If a string has a %3, the
extraValue parameter will be substituted for it.
Parameters: permission - ID of the permission to check for,the ID must be fromcom.sun.midp.security.Permissions Parameters: title - Resource constant for the title of the dialog Parameters: question - Resource constant for the question to ask user Parameters: oneShotQuestion - Resource constant for the oneshot question toask the user Parameters: app - name of the application to insert into a stringcan be null if no %1 a string Parameters: resource - string to insert into a string,can be null if no %2 in a string Parameters: extraValue - string to insert into a string,can be null if no %3 in a string Parameters: exceptionMsg - message if a security exception is thrown true if the permission interaction has permanentlychanged and the new state should be saved, this will only happenif the permission granted exception: SecurityException - if the permission is notallowed by this token exception: InterruptedException - if another thread interrupts thecalling thread while this method is waiting to preempt thedisplay. |
checkPermission | public int checkPermission(String permission)(Code) | | Get the status of the specified permission.
If no API on the device defines the specific permission
requested then it must be reported as denied.
If the status of the permission is not known because it might
require a user interaction then it should be reported as unknown.
Parameters: permission - to check if denied, allowed, or unknown. 0 if the permission is denied; 1 if the permission is allowed;-1 if the status is unknown |
initSecurityToken | static void initSecurityToken(SecurityToken token)(Code) | | Initializes the security token for this class, so it can
perform actions that a normal MIDlet Suite cannot.
Parameters: token - security token for this class. |
|
|