/** Creates a new instance of WSITServerAuthContext */ @SuppressWarnings("unchecked") public WSITServerAuthContext( String operation, Subject subject, Map<Object, Object> map, CallbackHandler callbackHandler) { super(map); this.operation = operation; // this.subject = subject; // this.map = map; endPoint = new WeakReference((WSEndpoint) map.get("ENDPOINT")); sessionManager = SessionManager.getSessionManager(endPoint.get()); Iterator it = inMessagePolicyMap.values().iterator(); Set configAssertions = null; while (it.hasNext()) { SecurityPolicyHolder holder = (SecurityPolicyHolder) it.next(); if (configAssertions != null) { configAssertions.addAll( holder.getConfigAssertions(Constants.SUN_WSS_SECURITY_SERVER_POLICY_NS)); } else { configAssertions = holder.getConfigAssertions(Constants.SUN_WSS_SECURITY_SERVER_POLICY_NS); } if (trustConfig != null) { trustConfig.addAll( holder.getConfigAssertions( com.sun.xml.ws.security.impl.policy.Constants.SUN_TRUST_SERVER_SECURITY_POLICY_NS)); } else { trustConfig = holder.getConfigAssertions( com.sun.xml.ws.security.impl.policy.Constants.SUN_TRUST_SERVER_SECURITY_POLICY_NS); } if (wsscConfig != null) { wsscConfig.addAll( holder.getConfigAssertions( com.sun.xml.ws.security.impl.policy.Constants .SUN_SECURE_SERVER_CONVERSATION_POLICY_NS)); } else { wsscConfig = holder.getConfigAssertions( com.sun.xml.ws.security.impl.policy.Constants .SUN_SECURE_SERVER_CONVERSATION_POLICY_NS); } } String isGF = System.getProperty("com.sun.aas.installRoot"); if (isGF != null) { try { Properties props = new Properties(); populateConfigProperties(configAssertions, props); String jmacHandler = props.getProperty(DefaultCallbackHandler.JMAC_CALLBACK_HANDLER); if (jmacHandler != null) { handler = loadGFHandler(false, jmacHandler); } else if (callbackHandler != null) { handler = callbackHandler; } if (handler == null) { handler = loadGFHandler(false, jmacHandler); } secEnv = new WSITProviderSecurityEnvironment(handler, map, props); } catch (XWSSecurityException ex) { log.log( Level.SEVERE, LogStringsMessages.WSITPVD_0048_ERROR_POPULATING_SERVER_CONFIG_PROP(), ex); throw new WebServiceException( LogStringsMessages.WSITPVD_0048_ERROR_POPULATING_SERVER_CONFIG_PROP(), ex); } } else { // This will handle Non-GF containers where no config assertions // are required in the WSDL. Ex. UsernamePassword validatio // with Default Realm Authentication Properties props = new Properties(); handler = configureServerHandler(configAssertions, props); String jmacHandler = props.getProperty(DefaultCallbackHandler.JMAC_CALLBACK_HANDLER); if (jmacHandler != null) { try { handler = loadGFHandler(false, jmacHandler); secEnv = new WSITProviderSecurityEnvironment(handler, map, props); } catch (XWSSecurityException ex) { log.log( Level.SEVERE, LogStringsMessages.WSITPVD_0048_ERROR_POPULATING_SERVER_CONFIG_PROP(), ex); throw new WebServiceException( LogStringsMessages.WSITPVD_0048_ERROR_POPULATING_SERVER_CONFIG_PROP(), ex); } } else { secEnv = new DefaultSecurityEnvironmentImpl(handler, props); } } // initialize the AuthModules and keep references to them authModule = new WSITServerAuthModule(); try { authModule.initialize(null, null, null, map); } catch (AuthException e) { log.log(Level.SEVERE, LogStringsMessages.WSITPVD_0028_ERROR_INIT_AUTH_MODULE(), e); throw new RuntimeException(LogStringsMessages.WSITPVD_0028_ERROR_INIT_AUTH_MODULE(), e); } }