|
VLJ Iteration II, v. 1.0.0.193 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gov.va.med.foundations.security.vistalink.VistaKernelPrincipalImpl
A JAAS principal representing a logged on Kernel user on an M system.
Retrieving the principal after login
Upon a successful JAAS login, one or more principals may be
contained in the JAAS subject that is returned from a successful JAAS login (only one *Kernel* principal should be
returned, however. The situation in which multiple principals could be returned is if some kind of compound logon has
been set up that requires several logons to complete, for example one to Kernel, and one to a separate health data
repository). The VistaKernelPrincipal interface is a marker you can use to identify a "VistaKernelPrincipal" as one
of those principals. However, an easier approach is to use the helper method getKernelPrincipal
in
VistaKernelPrincipalImpl
to directly retrieve the single VistaKernelPrincipal. For example:
String cfgName = "RpcSampleServer"; // create the callback handler CallbackHandlerSwing cbhSwing = new CallbackHandlerSwing(myFrame); // create the LoginContext loginContext = new LoginContext(cfgName, cbhSwing); // login to server loginContext.login(); // get principal userPrincipal = VistaKernelPrincipalImpl.getKernelPrincipal(loginContext.getSubject());
Retrieving the authenticated connection from the principal
To execute RPCs, you'll need to retrieve the authenticated connection. Once a successful login has been completed, you can retrieve the associated authenticated connection from the Kernel principal. For example:
VistaLinkConnection myConnection = userPrincipal.getAuthenticatedConnection(); RpcRequest vReq = RpcRequestFactory.getRpcRequest(rpcContext, "XOB VL TEST PING"); RpcResponse vResp = myConnection.executeRPC(vReq);
Retrieving Demographics
You can use the KEY* field strings to retrieve user demographics values via the
getUserDemographicValue
method. For example:
private VistaKernelPrincipalImpl userPrincipal; // left out: perform a login... then the subject in the logincontext is populated // get the Kernel principal after successful login userPrincipal = VistaKernelPrincipalImpl.getKernelPrincipal(loginContext.getSubject()); // get user demographics String duz = this.userPrincipal.getUserDemographicValue(VistaKernelPrincipalImpl.KEY_DUZ); String name = userPrincipal.getUserDemographicValue(VistaKernelPrincipalImpl.KEY_NAME_DISPLAY);
VistaKernelPrincipal
,
Serialized FormField Summary |
Fields inherited from interface gov.va.med.foundations.security.vistalink.VistaKernelPrincipal |
KEY_DIVISION_IEN, KEY_DIVISION_STATION_NAME, KEY_DIVISION_STATION_NUMBER, KEY_DTIME, KEY_DUZ, KEY_LANGUAGE, KEY_NAME_DEGREE, KEY_NAME_DISPLAY, KEY_NAME_FAMILYLAST, KEY_NAME_GIVENFIRST, KEY_NAME_MIDDLE, KEY_NAME_NEWPERSON01, KEY_NAME_PREFIX, KEY_NAME_SUFFIX, KEY_SERVICE_SECTION, KEY_TITLE |
Method Summary | |
boolean |
equals(java.lang.Object o)
Returns whether some object equals this one. |
gov.va.med.foundations.adapter.cci.VistaLinkConnection |
getAuthenticatedConnection()
Retrieve the authenticated connection from this principal after logon. |
static gov.va.med.foundations.security.vistalink.VistaKernelPrincipalImpl |
getKernelPrincipal(javax.security.auth.Subject jaasSubject)
Returns the single Kernel principal contained in a JAAS subject returned by a JAAS LoginContext after a successful VistaLink logon to Vista. |
java.lang.String |
getName()
get the Principal's full name from the New Person .01 field. |
java.lang.String |
getUserDemographicValue(java.lang.String key)
returns a given user demographic value. |
int |
hashCode()
Compute the hash code for this VistaKernelPrincipalImpl object. |
java.lang.String |
toString()
Rudimentary toString method. |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
public java.lang.String getName()
getName
in interface VistaKernelPrincipal
Principal.getName()
public gov.va.med.foundations.adapter.cci.VistaLinkConnection getAuthenticatedConnection()
public java.lang.String getUserDemographicValue(java.lang.String key)
VistaKernelPrincipal
getUserDemographicValue
in interface VistaKernelPrincipal
key
- The key under which the demographic value is stored
VistaKernelPrincipal.getUserDemographicValue(String)
public java.lang.String toString()
toString
in interface VistaKernelPrincipal
toString
in class java.lang.Object
Principal.toString()
public boolean equals(java.lang.Object o)
equals
in interface VistaKernelPrincipal
equals
in class java.lang.Object
o
- object to compare.
Principal.equals(Object)
public int hashCode()
hashCode
in interface java.security.Principal
hashCode
in class java.lang.Object
Object.hashCode()
public static gov.va.med.foundations.security.vistalink.VistaKernelPrincipalImpl getKernelPrincipal(javax.security.auth.Subject jaasSubject) throws FoundationsException
jaasSubject
- JAAS subject returned by a JAAS LoginContext after a successful VistaLink
logon to Vista.
FoundationsException
- If no Kernel principal, or more than one, are found, an exception is thrown
|
VLJ Iteration II, v. 1.0.0.193 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |