1 | package gov.hhs.fha.nhinc.token;
|
---|
2 |
|
---|
3 | import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType;
|
---|
4 | import gov.hhs.fha.nhinc.nhinccomponenttokeninfomanager.NhincComponentTokenInfoManagerPortType;
|
---|
5 | import javax.ejb.Stateless;
|
---|
6 | import javax.jws.WebService;
|
---|
7 | import org.apache.commons.logging.Log;
|
---|
8 | import org.apache.commons.logging.LogFactory;
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * This class exposes the Saml Token Manager Services. These services are used
|
---|
12 | * to write information needed in the Saml token to a file and to retrieve those
|
---|
13 | * values.
|
---|
14 | *
|
---|
15 | * @author Victoria Vickers
|
---|
16 | * @author Neil Webb
|
---|
17 | */
|
---|
18 | @WebService(serviceName = "NhincComponentTokenInfoManagerService", portName = "NhincComponentTokenInfoManagerPort", endpointInterface = "gov.hhs.fha.nhinc.nhinccomponenttokeninfomanager.NhincComponentTokenInfoManagerPortType", targetNamespace = "urn:gov:hhs:fha:nhinc:nhinccomponenttokeninfomanager", wsdlLocation = "META-INF/wsdl/TokenInfoManager/NhincComponentTokenInfoManager.wsdl")
|
---|
19 | @Stateless
|
---|
20 | public class TokenInfoManager implements NhincComponentTokenInfoManagerPortType
|
---|
21 | {
|
---|
22 | private static Log log = LogFactory.getLog(TokenInfoManager.class);
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * This method wraps the POJO which retrieves the extracted information
|
---|
26 | * from the SAML Token and creates a new Assertion object.
|
---|
27 | * @param request Currently not used
|
---|
28 | * @return The new Assertion object containing the extracted token information
|
---|
29 | */
|
---|
30 | public gov.hhs.fha.nhinc.common.nhinccommon.AssertionType retrieveInfoOperation(gov.hhs.fha.nhinc.common.nhinccommon.TokenRetrieveInfoType request)
|
---|
31 | {
|
---|
32 | log.debug("TokenInfoManager.retrieveInfoOperation() -- Begin");
|
---|
33 | AssertionType assertInfo = null;
|
---|
34 | InternalTokenMgr mgr = new InternalTokenMgr();
|
---|
35 | try
|
---|
36 | {
|
---|
37 | assertInfo = mgr.retrieveInfoOperation();
|
---|
38 | }
|
---|
39 | catch (Exception e)
|
---|
40 | {
|
---|
41 | log.error("Exception occurred: " + e.getMessage());
|
---|
42 | e.printStackTrace();
|
---|
43 | }
|
---|
44 | log.debug("TokenInfoManager.retrieveInfoOperation() -- End");
|
---|
45 | return assertInfo;
|
---|
46 | }
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * This method wraps the POJO which stores the information needed to create
|
---|
50 | * the SAML Token.
|
---|
51 | * @param infoIn Composite object enclosing the assertion information as
|
---|
52 | * well as values set by the bpel to provide action and resource names.
|
---|
53 | */
|
---|
54 | public void storeInfoOperation(gov.hhs.fha.nhinc.common.nhinccommon.TokenCreationInfoType infoIn)
|
---|
55 | {
|
---|
56 | log.debug("TokenInfoManager.storeInfoOperation() -- Begin");
|
---|
57 | InternalTokenMgr mgr = new InternalTokenMgr();
|
---|
58 | try
|
---|
59 | {
|
---|
60 | if (infoIn != null)
|
---|
61 | {
|
---|
62 | mgr.storeInfoOperation(infoIn.getAssertion(), infoIn.getActionName(), infoIn.getResourceName());
|
---|
63 | }
|
---|
64 | else
|
---|
65 | {
|
---|
66 | log.info("TokenInfoManager.storeInfoOperation expects an non-null input");
|
---|
67 | }
|
---|
68 | }
|
---|
69 | catch (Exception e)
|
---|
70 | {
|
---|
71 | log.error("Exception occurred: " + e.getMessage());
|
---|
72 | e.printStackTrace();
|
---|
73 | }
|
---|
74 | log.debug("TokenInfoManager.storeInfoOperation() -- End");
|
---|
75 | }
|
---|
76 | }
|
---|