|
VistALink v1.6 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.va.med.vistalink.security.VistaKernelPrincipalImpl
public final class 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:
// create the callback handler
// create the LoginContext
// login to server
// get principal
String cfgName = "RpcSampleServer";
CallbackHandlerSwing cbhSwing = new CallbackHandlerSwing(myFrame);
loginContext = new LoginContext(cfgName, cbhSwing);
loginContext.login();
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:
// left out: perform a login... then the subject in the logincontext is populated
// get the Kernel principal after successful login
// get user demographics
private VistaKernelPrincipalImpl userPrincipal;
userPrincipal = VistaKernelPrincipalImpl.getKernelPrincipal(loginContext.getSubject());
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.vistalink.security.m.VistaKernelPrincipal |
---|
KEY_DIVISION_IEN, KEY_DIVISION_STATION_NAME, KEY_DIVISION_STATION_NUMBER, KEY_DOMAIN_NAME, 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, KEY_VPID |
Method Summary | |
---|---|
VistaLinkConnection |
getAuthenticatedConnection()
Retrieve the authenticated connection from this principal after logon. |
static 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. |
java.lang.String |
toString()
Rudimentary toString method. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface gov.va.med.vistalink.security.m.VistaKernelPrincipal |
---|
equals |
Methods inherited from interface java.security.Principal |
---|
hashCode |
Method Detail |
---|
public java.lang.String getName()
getName
in interface VistaKernelPrincipal
getName
in interface java.security.Principal
Principal.getName()
public 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 interface java.security.Principal
toString
in class java.lang.Object
Principal.toString()
public static 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
|
VistALink v1.6 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |