|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
An AuthFilter is a plain java class implementing data visibility logic
for use by UI nodes and Authorizer nodes. It provides a
standard approach to filtering data access at the message, field, and
value levels. Functionally it works like a firewall for messages, with
the UI checking to see what is reasonable to try send through. With
both types of processing working off the same code, the system is
secure from rogue clients, and the UI doesn't let the user get into
trouble trying to do something they are not allowed to do.
The caller is responsible for checking access in order.
In addition a caller must verify that all matchRestrictions are in place for any outbound or inbound query. Under no circumstances should data not processed in accordance with the matchRestrictions be allowed to pass through unauthorized.
A user interface should check any custom buttons or navigation links through a call to tokenAccess. This allows authorization to turn off custom actions which would not work due to authorization context, without having the user have to discover this by trying and failing. This is a convenience method and not a security measure.
Data filtering could potentially break due to a wide variety of reasons, such as not being able to look up the username due to a communications problem, or whatever. The methods are therefore declared to throw the common SandException on failure.
Please take care defining data visibility where struct inheritance is involved. Restrictions do NOT propagate upwards through the inheritance hierarchy. Message and field level restrictions MUST be declared at the highest possible inheritance level for proper function. Both forms of access can then be further restricted at the lower inheritance levels.
| Field Summary | |
static int |
AUTH_NOACCESS
The user is not allowed access to this field or message at all. |
static int |
AUTH_READONLY
The user is allowed to query and view the message or field and its data, but they may not make changes to it. |
static int |
AUTH_UNRESTRICTED
The user is allowed to query, read, modify the message or field and its data. |
static int |
AUTH_VALHIDDEN
The user is allowed access to the field, so they can see that the field exists, but they are not allowed access to the field value in this instance. |
| Method Summary | |
SandAttrVal[] |
matchRestrictions(AuthUser user,
java.lang.String className,
SandAttrVal[] savs)
Return additional match constraints for a query or entry display. |
int |
messageClassAccess(AuthUser user,
java.lang.String className)
Return one of the AUTH* constants describing allowed access to the specified class. |
int |
messageFieldAccess(AuthUser user,
SandMessage msg,
java.lang.String fieldName)
Return one of the AUTH* constants describing the allowed access to the specified field in the specified class. |
int |
messageFieldValueAccess(AuthUser user,
SandMessage msg,
java.lang.String fieldName)
Return one of the AUTH* constants describing the allowed access to the specified field in the given message instance. |
int |
messageInstanceAccess(AuthUser user,
SandMessage msg)
Return one of the AUTH* constants describing allowed access to the specified class instance. |
int |
tokenAccess(AuthUser user,
java.lang.String token)
Return one of the AUTH* constants describing the allowed access to the specified token. |
| Field Detail |
public static final int AUTH_NOACCESS
public static final int AUTH_VALHIDDEN
This value is typically only used when displaying information
returned from a query. Showing a field without showing the value
doesn't exactly make users feel empowered, but can be necessary in
some instances.
public static final int AUTH_READONLY
public static final int AUTH_UNRESTRICTED
| Method Detail |
public int messageClassAccess(AuthUser user,
java.lang.String className)
throws SandException
Usage:
SandException
public int messageInstanceAccess(AuthUser user,
SandMessage msg)
throws SandException
Usage:
This method is called only if messageClassAccess is allowed.
SandException
public int messageFieldAccess(AuthUser user,
SandMessage msg,
java.lang.String fieldName)
throws SandException
Usage:
This method is called only if messageInstanceAccess is allowed.
SandException
public int messageFieldValueAccess(AuthUser user,
SandMessage msg,
java.lang.String fieldName)
throws SandException
Usage:
This method is called only if messageFieldAccess is allowed.
SandException
public SandAttrVal[] matchRestrictions(AuthUser user,
java.lang.String className,
SandAttrVal[] savs)
throws SandException
The match constraints are added by the Authorizer when
processing a query, to prevent unauthorized information from
being retrieved. The same constraints can also be used by the
UI to filter and check for invalid options.
When filtering possible field values in the UI, care must be
taken to monitor the number of available values remaining. If
only one value is possible, then the field should be switched
to READONLY with that value. If no values are possible the field
should be switched to NOACCESS. Similar logic applies to range
reductions on integer values.
The current query values are provided as a reference for existing restrictions to avoid duplication or add successive refinements.
Usage:
SandException
public int tokenAccess(AuthUser user,
java.lang.String token)
throws SandException
Usage:
SandException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||