1 23 24 27 28 package com.sun.enterprise.admin.wsmgmt.agent; 29 30 import java.security.Principal ; 31 import com.sun.enterprise.webservice.monitoring.AuthenticationListener; 32 import com.sun.enterprise.webservice.monitoring.WebServiceEngine; 33 import com.sun.enterprise.webservice.monitoring.WebServiceEngineFactory; 34 import com.sun.enterprise.webservice.monitoring.Endpoint; 35 import com.sun.enterprise.deployment.BundleDescriptor; 36 import com.sun.enterprise.admin.wsmgmt.WebServiceMgrBackEnd; 37 import com.sun.enterprise.admin.wsmgmt.stats.spi.StatsProviderManager; 38 import com.sun.enterprise.admin.wsmgmt.config.spi.ConfigProvider; 39 import com.sun.enterprise.admin.wsmgmt.config.spi.ConfigFactory; 40 import com.sun.enterprise.admin.wsmgmt.config.spi.WebServiceConfig; 41 import com.sun.enterprise.admin.wsmgmt.stats.impl.WebServiceEndpointStatsProviderImpl; 42 43 import java.util.logging.Logger ; 44 import java.util.logging.Level ; 45 import com.sun.logging.LogDomains; 46 import com.sun.enterprise.util.i18n.StringManager; 47 48 54 public class AuthenticationListenerImpl implements AuthenticationListener { 55 56 public AuthenticationListenerImpl() { 57 try { 58 cfgProv = ConfigFactory.getConfigFactory().getConfigProvider(); 59 } catch (Exception e) { 60 _logger.fine("Config provider could not be initialized " + 61 e.getMessage()); 62 } 63 } 64 65 69 public void authSucess(BundleDescriptor desc, Endpoint ep, Principal principal) { 70 } 72 73 78 public void authFailure(BundleDescriptor desc, Endpoint ep, Principal principal) { 79 if (ep == null) { 80 _logger.fine("Endpoint is null for " + desc.getModuleID()); 81 return; 82 } 83 String fqn =WebServiceMgrBackEnd.getManager().getFullyQualifiedName(ep); 85 if (fqn == null) { 86 _logger.fine("Fully Qualified could not be computed for the selector " + 87 ep.getEndpointSelector()); 88 return; 89 } 90 WebServiceConfig wsc = cfgProv.getWebServiceConfig(fqn); 91 if ((wsc == null) || (wsc.getMonitoringLevel() == null) 92 || (wsc.getMonitoringLevel().equals("OFF"))) { 93 _logger.fine("Monitoring is OFF for webservice endpoint " + 95 fqn); 96 return; 97 } 98 WebServiceEndpointStatsProviderImpl impl = ( 100 WebServiceEndpointStatsProviderImpl) StatsProviderManager. 101 getInstance().getEndpointStatsProvider(fqn); 102 if (impl == null) { 103 if (cfgProv != null) { 104 String msg = _stringMgr.getString("Auth.StatsNotReg", fqn); 105 throw new RuntimeException (msg); 106 } 107 return; 108 } 109 impl.setAuthFailure(System.currentTimeMillis()); 111 } 112 113 114 private static final Logger _logger = 115 Logger.getLogger(LogDomains.ADMIN_LOGGER); 116 private ConfigProvider cfgProv = null; 117 private static final StringManager _stringMgr = 118 StringManager.getManager(AuthenticationListenerImpl.class); 119 } 120 | Popular Tags |