* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import org.apache.log4j.Logger;
import org.onap.aaf.cadi.CadiException;
import org.onap.aaf.cadi.LocatorException;
import org.apache.log4j.Logger;
import org.onap.aaf.cadi.CadiException;
import org.onap.aaf.cadi.LocatorException;
public class AafLurAndFish implements ApiAuthorizationCheckInterface {
private AafLurService svc;
private static String apiNamespace;
private static final String ERROR="Error";
static final Logger logger = Logger.getLogger(AafLurAndFish.class);
public class AafLurAndFish implements ApiAuthorizationCheckInterface {
private AafLurService svc;
private static String apiNamespace;
private static final String ERROR="Error";
static final Logger logger = Logger.getLogger(AafLurAndFish.class);
DmaapConfig p = (DmaapConfig)DmaapConfig.getConfig();
apiNamespace = p.getProperty( "ApiNamespace", "org.onap.dmaap-bc.api");
DmaapConfig p = (DmaapConfig)DmaapConfig.getConfig();
apiNamespace = p.getProperty( "ApiNamespace", "org.onap.dmaap-bc.api");
svc = AafLurService.getInstance(myAccess);
} catch (APIException | CadiException | LocatorException e ) {
logger.error(ERROR, e);
logger.error( e.toString() );
throw new AuthenticationErrorException();
}
svc = AafLurService.getInstance(myAccess);
} catch (APIException | CadiException | LocatorException e ) {
logger.error(ERROR, e);
logger.error( e.toString() );
throw new AuthenticationErrorException();
}
- boolean resp = svc.checkPerm( apiNamespace, mechid, pwd, p );
- boolean flag = false;
- if ( resp == flag ) {
+ if (mechid.isEmpty() || pwd.isEmpty()) {
+ throw new AuthenticationErrorException("No basic authorization value provided");
+ }
+
+ if (!svc.checkPerm( apiNamespace, mechid, pwd, p )) {
public static void main(String[] args) throws Exception {
AafLurAndFish alaf = new AafLurAndFish();
DmaapPerm p = new DmaapPerm( "org.onap.dmaap-bc.api.dmaap", "boot", "GET");
public static void main(String[] args) throws Exception {
AafLurAndFish alaf = new AafLurAndFish();
DmaapPerm p = new DmaapPerm( "org.onap.dmaap-bc.api.dmaap", "boot", "GET");
try {
alaf.check("mmanager@people.osaaf.org", "demo123456!", p);
} catch (AuthenticationErrorException aee ) {
try {
alaf.check("mmanager@people.osaaf.org", "demo123456!", p);
} catch (AuthenticationErrorException aee ) {