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