update the package name
[dmaap/messagerouter/msgrtr.git] / src / main / java / org / onap / dmaap / dmf / mr / security / impl / DMaaPMechIdAuthenticator.java
1 /*******************************************************************************
2  *  ============LICENSE_START=======================================================
3  *  org.onap.dmaap
4  *  ================================================================================
5  *  Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  *  ================================================================================
7  *  Licensed under the Apache License, Version 2.0 (the "License");
8  *  you may not use this file except in compliance with the License.
9  *  You may obtain a copy of the License at
10  *        http://www.apache.org/licenses/LICENSE-2.0
11 *  
12  *  Unless required by applicable law or agreed to in writing, software
13  *  distributed under the License is distributed on an "AS IS" BASIS,
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License.
17  *  ============LICENSE_END=========================================================
18  *  
19  *  ECOMP is a trademark and service mark of AT&T Intellectual Property.
20  *  
21  *******************************************************************************/
22 package org.onap.dmaap.dmf.mr.security.impl;
23
24 import javax.servlet.http.HttpServletRequest;
25
26 import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
27 import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticator;
28
29 import com.att.eelf.configuration.EELFLogger;
30 import com.att.eelf.configuration.EELFManager;
31 import com.att.nsa.security.NsaApiKey;
32 import com.att.nsa.security.authenticators.MechIdAuthenticator;
33
34 /**
35  * An authenticator for AT&T MechIds.
36  * 
37  * @author peter
38  *
39  * @param <K>
40  */
41 public class DMaaPMechIdAuthenticator <K extends NsaApiKey> implements DMaaPAuthenticator<K> {
42
43 /**
44  * This is not yet implemented. by refault its returing false
45  * @param req HttpServletRequest
46  * @return false
47  */
48         public boolean qualify (HttpServletRequest req) {
49                 // we haven't implemented anything here yet, so there's no qualifying request
50                 return false;
51         }
52 /**
53  * This metod authenticate the mech id 
54  * @param req
55  * @return APIkey or null
56  */
57         public K isAuthentic (HttpServletRequest req) {
58                 final String remoteAddr = req.getRemoteAddr();
59                 authLog ( "MechId auth is not yet implemented.", remoteAddr );
60                 return null;
61         }
62
63         private static void authLog ( String msg, String remoteAddr )
64         {
65                 log.info ( "AUTH-LOG(" + remoteAddr + "): " + msg );
66         }
67
68
69         //private static final Logger log = Logger.getLogger( MechIdAuthenticator.class.toString());
70         private static final EELFLogger log = EELFManager.getInstance().getLogger(MechIdAuthenticator.class);
71 /**
72  * Curently its not yet implemented returning null
73  * @param ctx DMaaP context
74  * @return APIkey or null
75  */
76         @Override
77         public K authenticate(DMaaPContext ctx) {
78                 // TODO Auto-generated method stub
79                 return null;
80         }
81 @Override
82 public void addAuthenticator(DMaaPAuthenticator<K> a) {
83         // TODO Auto-generated method stub
84         
85 }
86
87 }