DMAAP-MR - Merge MR repos
[dmaap/messagerouter/messageservice.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 com.att.eelf.configuration.EELFLogger;
25 import com.att.eelf.configuration.EELFManager;
26 import com.att.nsa.security.NsaApiKey;
27 import com.att.nsa.security.authenticators.MechIdAuthenticator;
28 import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
29 import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticator;
30
31 import javax.servlet.http.HttpServletRequest;
32
33 /**
34  * An authenticator for AT&T MechIds.
35  * 
36  * @author peter
37  *
38  * @param <K>
39  */
40 public class DMaaPMechIdAuthenticator <K extends NsaApiKey> implements DMaaPAuthenticator<K> {
41
42 /**
43  * This is not yet implemented. by refault its returing false
44  * @param req HttpServletRequest
45  * @return false
46  */
47         public boolean qualify (HttpServletRequest req) {
48                 // we haven't implemented anything here yet, so there's no qualifying request
49                 return false;
50         }
51 /**
52  * This metod authenticate the mech id 
53  * @param req
54  * @return APIkey or null
55  */
56         public K isAuthentic (HttpServletRequest req) {
57                 final String remoteAddr = req.getRemoteAddr();
58                 authLog ( "MechId auth is not yet implemented.", remoteAddr );
59                 return null;
60         }
61
62         private static void authLog ( String msg, String remoteAddr )
63         {
64                 log.info ( "AUTH-LOG(" + remoteAddr + "): " + msg );
65         }
66
67
68         //private static final Logger log = Logger.getLogger( MechIdAuthenticator.class.toString());
69         private static final EELFLogger log = EELFManager.getInstance().getLogger(MechIdAuthenticator.class);
70 /**
71  * Curently its not yet implemented returning null
72  * @param ctx DMaaP context
73  * @return APIkey or null
74  */
75         @Override
76         public K authenticate(DMaaPContext ctx) {
77                 // TODO Auto-generated method stub
78                 return null;
79         }
80 @Override
81 public void addAuthenticator(DMaaPAuthenticator<K> a) {
82         // TODO Auto-generated method stub
83         
84 }
85
86 }