|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sandev.basics.Authorizer.AuthorizerNodeDecl
org.sandev.basics.Authorizer.AuthorizerNodeBase
org.sandev.basics.Authorizer.AuthorizerNode
An Authorizer node. An instance of this node would be deployed on either side of a secure communications path that bridges two separate process spaces.
| Field Summary | |
protected AuthUserLookup |
auLookup
Our AuthUserLookup, used for finding the user from the sandTransmitAuthID in a SandTransmitMessage. |
protected AuthFilter |
authfilter
Our AuthFilter, used for checking if we should accept a message, or manipulate it in any way before transmission. |
protected java.util.HashMap |
delmap
A map of message classes to node instances, used for delivery of incoming asynchronous sends. |
protected SandEncryptor |
encryptor
Our encryptor, used for encrypting serialized message object text for transmission. |
protected IDLookup |
idLookup
Our IDLookup, used for restoring field values that have been previously set to default values during authorization. |
protected java.util.HashMap |
recmap
A map of of message classes to node instances, used for receipt of incoming synchronous queries. |
protected CharSerializer |
serializer
Our serializer, used for translating message objects into or from a string. |
| Fields inherited from class org.sandev.basics.Authorizer.AuthorizerNodeBase |
ctrlwrappers, helperNodes, LOGDEBUG, LOGERROR, LOGFATAL, logger, LOGINFO, logLevel, LOGLEVEL_DEBUG, LOGLEVEL_ERROR, LOGLEVEL_FATAL, LOGLEVEL_INFO, LOGLEVEL_WARN, LOGWARN, messager, nodeInstance, parent, sandNodeErrorMessage, sandNodeState, SANDNODESTATE_FAILED, SANDNODESTATE_FAILING, SANDNODESTATE_RESUMING, SANDNODESTATE_RUNNING, SANDNODESTATE_STARTING, SANDNODESTATE_STOPPED, SANDNODESTATE_STOPPING, SANDNODESTATE_SUSPENDED, SANDNODESTATE_SUSPENDING, SANDNODESTATE_UNDEFINED, sandRoot |
| Fields inherited from class org.sandev.basics.Authorizer.AuthorizerNodeDecl |
authFilterClassName, authUserLookupInstanceName, encryptorName, lookupInstanceName, serializerClassName |
| Constructor Summary | |
AuthorizerNode()
|
|
| Method Summary | |
protected void |
authorizeAndRestore(SandMessage msg)
Throw an exception if this message is unauthorized, otherwise restore the instance data as necessary. |
protected AuthUser |
authorizeAndScrub(SandMessage msg)
Throw an exception if this message is unauthorized, otherwise scrub the data as necessary. |
protected AuthUser |
checkMessageAuthorization(SandMessage msg)
Verify that this user is allowed to send this message. |
void |
deliver(SandMessage msg)
Reject anything that is not an AuthWrapper, unwrap the message, and deliver it to the appropriate registered nodes. |
protected AuthUserLookup |
findAuthUserLookup()
Find our AuthUserLookup. |
protected IDLookup |
findIDLookup()
Find our IDLookup. |
AuthFilter |
getAuthFilter()
intializing accessor for authfilter |
AuthUserLookup |
getAuthUserLookup()
intializing accessor for auLookup |
java.util.HashMap |
getDelMap()
initializing accessor for delmap |
SandEncryptor |
getEncryptor()
initializing accessor for encryptor |
IDLookup |
getIDLookup()
intializing accessor for idLookup |
java.util.HashMap |
getRecMap()
initializing accessor for recmap |
CharSerializer |
getSerializer()
initializing accessor for serializer |
protected AuthFilter |
instantiateAuthFilter()
Instantiate a new AuthFilter. |
protected SandEncryptor |
instantiateEncryptor()
Instantiate a new SandEncryptor. |
protected CharSerializer |
instantiateSerializer()
Instantiate a new serializer. |
protected boolean |
isQualifiedInitialUserQuery(SandTransmitMessage stm)
Return true if this is a SandQueryMessage for an AuthUser that explicitely matches the username and password. |
SandMessage |
query(SandMessage msg,
java.lang.String recipient,
int optimize)
Wrap the given message into an AuthWrapper, then query the recipient via unsecure (direct) messaging. |
SandMessage |
receive(SandMessage msg)
Reject anything that is not an AuthWrapper, unwrap the contained message, lookup the registered recipient, and call through to it directly, returning the result wrapped as an AuthWrapper. |
void |
registerDelivery(java.lang.String msgClass,
Messageable node)
Register this node as a receiver for all messages of this class that are delivered. |
void |
registerReceive(java.lang.String msgClass,
Messageable node)
Register the given node as the processor for all queries of this message class that are received. |
protected void |
restoreCurrentFieldValues(AuthUser user,
SandInstanceMessage msg)
Restore the field values that had been set to their defaults due to authorization restrictions. |
void |
send(SandMessage msg,
int optimize)
Wrap the given message into an AuthWrapper, then send it via unsecure (direct) messaging. |
protected void |
setFieldsToDefaultValues(AuthUser user,
SandInstanceMessage msg)
Set any unauthorized fields to their default values. |
protected void |
setTransmitIDFromQueryResult(SandTransmitMessage msg)
If this is a collection which is the result of a qualified initial user query, then set the transmission ID now that we have the uniqueID of the AuthUser. |
void |
unregisterDelivery(java.lang.String msgClass,
Messageable node)
Unregister this node as a receiver for all messages of this class that are delivered. |
protected SandMessage |
unwrap(AuthWrapper wrapper)
Unwrap the contained SandMessage and return that. |
protected void |
verifyMatchRestrictions(AuthUser user,
SandQueryMessage msg)
Get the additional match restrictions for this user via our AuthFilter and make sure they are present in the match description. |
protected AuthWrapper |
wrap(AuthUser user,
SandMessage msg)
Wrap the given message in an AuthWrapper and return it. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.util.HashMap delmap
protected java.util.HashMap recmap
protected CharSerializer serializer
protected SandEncryptor encryptor
protected AuthFilter authfilter
protected IDLookup idLookup
protected AuthUserLookup auLookup
| Constructor Detail |
public AuthorizerNode()
| Method Detail |
public java.util.HashMap getDelMap()
public java.util.HashMap getRecMap()
public CharSerializer getSerializer()
public SandEncryptor getEncryptor()
public AuthFilter getAuthFilter()
getAuthFilter in interface Authorizerpublic IDLookup getIDLookup()
public AuthUserLookup getAuthUserLookup()
public void registerDelivery(java.lang.String msgClass,
Messageable node)
throws MessagerException
registerDelivery in interface AuthorizerMessagerException
public void unregisterDelivery(java.lang.String msgClass,
Messageable node)
throws MessagerException
unregisterDelivery in interface AuthorizerMessagerException
public void registerReceive(java.lang.String msgClass,
Messageable node)
throws MessagerException
registerReceive in interface AuthorizerMessagerException
public void deliver(SandMessage msg)
throws SandException
Note that there is no authorization done here at the receiving end, since the outbound data will already have been scrubbed.
deliver in interface Authorizerdeliver in class AuthorizerNodeBaseSandException
public void send(SandMessage msg,
int optimize)
throws MessagerException
send in interface AuthorizerMessagerException
public SandMessage query(SandMessage msg,
java.lang.String recipient,
int optimize)
throws MessagerException
query in interface AuthorizerMessagerException
public SandMessage receive(SandMessage msg)
throws SandException
The appropriate recipient will have been registered already. If no appropriate recipient is found, this method throws.
receive in interface Authorizerreceive in class AuthorizerNodeBaseSandException
protected AuthUser authorizeAndScrub(SandMessage msg)
throws MessagerException
MessagerException
protected void authorizeAndRestore(SandMessage msg)
throws MessagerException
MessagerExceptionprotected boolean isQualifiedInitialUserQuery(SandTransmitMessage stm)
An AuthUser is characterized by getUsername and getPassword methods. These are typically generated by having the AuthUser struct define fields called "username" and "password". While it's possible to accomplish this in other ways, it doesn't seem worth the effort of extending SandQueryMessage to include an isQualifiedInitialUserQuery method until we see a driving use case in the real world. So this method simply looks for those fields to see if this is a qualified initial user query.
protected void setTransmitIDFromQueryResult(SandTransmitMessage msg)
throws SandException
SandException
protected AuthUser checkMessageAuthorization(SandMessage msg)
throws MessagerException
For everything with a sandTransmitAuthID, we retrieve the associated user via our local lookup node, and then call our AuthFilter to find out if the user is allowed to deal with the specified message instance. If not, then we throw.
MessagerException
protected void verifyMatchRestrictions(AuthUser user,
SandQueryMessage msg)
throws MessagerException
Besides making sure the additional match restrictions are present, we also need to make sure the query does not specify any unauthorized fields. Otherwise the user could figure things out from queries even while receiving only the defaulted values back. If an unauthorized field is specified in the match info, an exception is thrown.
MessagerException
protected void setFieldsToDefaultValues(AuthUser user,
SandInstanceMessage msg)
throws MessagerException
MessagerException
protected void restoreCurrentFieldValues(AuthUser user,
SandInstanceMessage msg)
throws MessagerException
The last Authorizer in the call chain before the DataManager must perform this replacement for updates to contain the correct information. Otherwise the default values will be written to permanent storage. The messaging chain can be checked by reading the deployment configuration.
MessagerException
protected AuthWrapper wrap(AuthUser user,
SandMessage msg)
throws MessagerException
MessagerException
protected SandMessage unwrap(AuthWrapper wrapper)
throws MessagerException
MessagerExceptionprotected CharSerializer instantiateSerializer()
protected SandEncryptor instantiateEncryptor()
protected AuthFilter instantiateAuthFilter()
protected IDLookup findIDLookup()
protected AuthUserLookup findAuthUserLookup()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||