1 package org.onap.ccsdk.features.sdnr.wt.oauthprovider;
3 import org.jolokia.osgi.security.Authenticator;
4 import org.onap.ccsdk.features.sdnr.wt.oauthprovider.data.InvalidConfigurationException;
5 import org.onap.ccsdk.features.sdnr.wt.oauthprovider.data.UnableToConfigureOAuthService;
6 import org.onap.ccsdk.features.sdnr.wt.oauthprovider.http.AuthHttpServlet;
7 import org.opendaylight.aaa.api.IdMService;
8 import org.opendaylight.mdsal.binding.api.DataBroker;
9 import org.opendaylight.yang.gen.v1.urn.opendaylight.aaa.app.config.rev170619.ShiroConfiguration;
10 import org.osgi.service.http.HttpService;
11 import org.osgi.service.http.NamespaceException;
12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory;
15 import javax.servlet.ServletException;
16 import java.io.IOException;
20 private static final Logger LOG = LoggerFactory.getLogger(Helper.class);
21 private AuthHttpServlet authServlet;
23 public Helper() throws UnableToConfigureOAuthService, IOException, InvalidConfigurationException {
24 this.authServlet = new AuthHttpServlet();
28 public void onUnbindService(HttpService httpService) {
29 httpService.unregister(AuthHttpServlet.BASEURI);
30 this.authServlet = null;
33 public void onBindService(HttpService httpService)
34 throws ServletException, NamespaceException {
35 if (httpService == null) {
36 LOG.warn("Unable to inject HttpService into loader.");
38 httpService.registerServlet(AuthHttpServlet.BASEURI, authServlet, null, null);
39 LOG.info("auth servlet registered.");
43 public void setOdlAuthenticator(Authenticator odlAuthenticator) {
44 authServlet.setOdlAuthenticator(odlAuthenticator);
47 public void setOdlIdentityService(IdMService odlIdentityService) {
48 this.authServlet.setOdlIdentityService(odlIdentityService);
51 public void setShiroConfiguration(ShiroConfiguration shiroConfiguration) {
52 this.authServlet.setShiroConfiguration(shiroConfiguration);
55 public void setDataBroker(DataBroker dataBroker) {
56 this.authServlet.setDataBroker(dataBroker);