You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2013/07/16 09:13:40 UTC
svn commit: r1503576 - in /cxf/trunk/services/sts:
sts-core/src/main/java/org/apache/cxf/sts/event/
sts-core/src/main/java/org/apache/cxf/sts/operation/
sts-core/src/main/java/org/apache/cxf/sts/provider/ sts-war/
sts-war/src/main/resources/ sts-war/sr...
Author: dkulp
Date: Tue Jul 16 07:13:39 2013
New Revision: 1503576
URL: http://svn.apache.org/r1503576
Log:
[CXF-5010] Pull spring stuff, define own interface
Revert change to log4j
Added:
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/STSEventListener.java
- copied, changed from r1503509, cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/AbstractSTSEvent.java
cxf/trunk/services/sts/sts-war/src/main/resources/logging.properties
Removed:
cxf/trunk/services/sts/sts-war/src/main/resources/log4j.properties
cxf/trunk/services/sts/sts-war/src/main/resources/org.apache.cxf.Logger
Modified:
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/AbstractSTSEvent.java
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/LoggerListener.java
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenCancelOperation.java
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenRenewOperation.java
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenValidateOperation.java
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/provider/DefaultSecurityTokenServiceProvider.java
cxf/trunk/services/sts/sts-war/pom.xml
cxf/trunk/services/sts/sts-war/src/main/webapp/WEB-INF/cxf-transport.xml
Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/AbstractSTSEvent.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/AbstractSTSEvent.java?rev=1503576&r1=1503575&r2=1503576&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/AbstractSTSEvent.java (original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/AbstractSTSEvent.java Tue Jul 16 07:13:39 2013
@@ -19,23 +19,31 @@
package org.apache.cxf.sts.event;
-import org.springframework.context.ApplicationEvent;
-
-public abstract class AbstractSTSEvent extends ApplicationEvent {
+public abstract class AbstractSTSEvent {
private static final long serialVersionUID = 1L;
private long duration;
-
+ private final long timestamp;
+ private final Object source;
+
public AbstractSTSEvent(Object source, long duration) {
- super(source);
this.duration = duration;
+ this.timestamp = System.currentTimeMillis();
+ this.source = source;
}
+
public abstract String getOperation();
public long getDuration() {
return duration;
}
+ public final long getTimestamp() {
+ return this.timestamp;
+ }
+ public final Object getSource() {
+ return source;
+ }
}
Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/LoggerListener.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/LoggerListener.java?rev=1503576&r1=1503575&r2=1503576&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/LoggerListener.java (original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/LoggerListener.java Tue Jul 16 07:13:39 2013
@@ -39,10 +39,7 @@ import org.apache.cxf.sts.token.renewer.
import org.apache.cxf.sts.token.validator.TokenValidatorParameters;
import org.apache.cxf.transport.http.AbstractHTTPDestination;
-import org.springframework.context.ApplicationListener;
-
-
-public class LoggerListener implements ApplicationListener<AbstractSTSEvent> {
+public class LoggerListener implements STSEventListener {
public enum KEYS {
TIME,
@@ -102,7 +99,7 @@ public class LoggerListener implements A
}
@Override
- public void onApplicationEvent(AbstractSTSEvent event) {
+ public void handleSTSEvent(AbstractSTSEvent event) {
if (event instanceof TokenProviderParametersSupport) {
handleEvent((TokenProviderParametersSupport)event);
Copied: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/STSEventListener.java (from r1503509, cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/AbstractSTSEvent.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/STSEventListener.java?p2=cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/STSEventListener.java&p1=cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/AbstractSTSEvent.java&r1=1503509&r2=1503576&rev=1503576&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/AbstractSTSEvent.java (original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/STSEventListener.java Tue Jul 16 07:13:39 2013
@@ -19,23 +19,9 @@
package org.apache.cxf.sts.event;
-import org.springframework.context.ApplicationEvent;
-
-public abstract class AbstractSTSEvent extends ApplicationEvent {
-
- private static final long serialVersionUID = 1L;
-
- private long duration;
-
- public AbstractSTSEvent(Object source, long duration) {
- super(source);
- this.duration = duration;
- }
-
- public abstract String getOperation();
-
- public long getDuration() {
- return duration;
- }
-
+/**
+ *
+ */
+public interface STSEventListener {
+ void handleSTSEvent(AbstractSTSEvent event);
}
Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java?rev=1503576&r1=1503575&r2=1503576&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java (original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java Tue Jul 16 07:13:39 2013
@@ -34,7 +34,6 @@ import javax.xml.namespace.QName;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;
-
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -48,6 +47,8 @@ import org.apache.cxf.sts.STSPropertiesM
import org.apache.cxf.sts.claims.ClaimsManager;
import org.apache.cxf.sts.claims.RequestClaim;
import org.apache.cxf.sts.claims.RequestClaimCollection;
+import org.apache.cxf.sts.event.AbstractSTSEvent;
+import org.apache.cxf.sts.event.STSEventListener;
import org.apache.cxf.sts.request.KeyRequirements;
import org.apache.cxf.sts.request.ReceivedToken;
import org.apache.cxf.sts.request.ReceivedToken.STATE;
@@ -82,14 +83,10 @@ import org.apache.wss4j.dom.message.WSSe
import org.apache.wss4j.dom.message.WSSecEncryptedKey;
import org.apache.wss4j.dom.util.XmlSchemaDateFormat;
-import org.springframework.context.ApplicationEvent;
-import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.context.ApplicationEventPublisherAware;
-
/**
* This abstract class contains some common functionality for different operations.
*/
-public abstract class AbstractOperation implements ApplicationEventPublisherAware {
+public abstract class AbstractOperation {
public static final QName TOKEN_TYPE =
new QName(WSConstants.WSSE11_NS, WSConstants.TOKEN_TYPE, WSConstants.WSSE11_PREFIX);
@@ -104,7 +101,7 @@ public abstract class AbstractOperation
protected boolean returnReferences = true;
protected TokenStore tokenStore;
protected ClaimsManager claimsManager = new ClaimsManager();
- protected ApplicationEventPublisher eventPublisher;
+ protected STSEventListener eventPublisher;
public boolean isReturnReferences() {
return returnReferences;
@@ -644,15 +641,14 @@ public abstract class AbstractOperation
}
}
- @Override
- public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
- this.eventPublisher = applicationEventPublisher;
+ public void setEventListener(STSEventListener eventListener) {
+ this.eventPublisher = eventListener;
}
- protected void publishEvent(ApplicationEvent event) {
+ protected void publishEvent(AbstractSTSEvent event) {
if (eventPublisher != null) {
- eventPublisher.publishEvent(event);
+ eventPublisher.handleSTSEvent(event);
}
}
}
Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenCancelOperation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenCancelOperation.java?rev=1503576&r1=1503575&r2=1503576&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenCancelOperation.java (original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenCancelOperation.java Tue Jul 16 07:13:39 2013
@@ -46,7 +46,6 @@ import org.apache.cxf.ws.security.sts.pr
import org.apache.cxf.ws.security.sts.provider.model.RequestedTokenCancelledType;
import org.apache.cxf.ws.security.sts.provider.operation.CancelOperation;
import org.apache.wss4j.common.ext.WSSecurityException;
-import org.springframework.context.ApplicationEvent;
/**
* An implementation for Cancel operation interface.
@@ -132,7 +131,7 @@ public class TokenCancelOperation extend
// prepare response
try {
RequestSecurityTokenResponseType response = createResponse(tokenRequirements);
- ApplicationEvent event = new STSCancelSuccessEvent(cancellerParameters,
+ STSCancelSuccessEvent event = new STSCancelSuccessEvent(cancellerParameters,
System.currentTimeMillis() - start);
publishEvent(event);
return response;
@@ -142,7 +141,7 @@ public class TokenCancelOperation extend
}
} catch (RuntimeException ex) {
- ApplicationEvent event = new STSCancelFailureEvent(cancellerParameters,
+ STSCancelFailureEvent event = new STSCancelFailureEvent(cancellerParameters,
System.currentTimeMillis() - start, ex);
publishEvent(event);
throw ex;
Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java?rev=1503576&r1=1503575&r2=1503576&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java (original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java Tue Jul 16 07:13:39 2013
@@ -66,7 +66,6 @@ import org.apache.wss4j.common.saml.Saml
import org.apache.wss4j.dom.WSSecurityEngineResult;
import org.apache.wss4j.dom.handler.WSHandlerConstants;
import org.apache.wss4j.dom.handler.WSHandlerResult;
-import org.springframework.context.ApplicationEvent;
/**
* An implementation of the IssueOperation interface.
@@ -208,7 +207,7 @@ public class TokenIssueOperation extends
createResponse(
encryptionProperties, tokenResponse, tokenRequirements, keyRequirements, context
);
- ApplicationEvent event = new STSIssueSuccessEvent(providerParameters,
+ STSIssueSuccessEvent event = new STSIssueSuccessEvent(providerParameters,
System.currentTimeMillis() - start);
publishEvent(event);
return response;
@@ -218,7 +217,7 @@ public class TokenIssueOperation extends
}
} catch (RuntimeException ex) {
- ApplicationEvent event = new STSIssueFailureEvent(providerParameters,
+ STSIssueFailureEvent event = new STSIssueFailureEvent(providerParameters,
System.currentTimeMillis() - start, ex);
publishEvent(event);
throw ex;
Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenRenewOperation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenRenewOperation.java?rev=1503576&r1=1503575&r2=1503576&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenRenewOperation.java (original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenRenewOperation.java Tue Jul 16 07:13:39 2013
@@ -53,7 +53,6 @@ import org.apache.cxf.ws.security.sts.pr
import org.apache.cxf.ws.security.sts.provider.model.RequestedSecurityTokenType;
import org.apache.cxf.ws.security.sts.provider.operation.RenewOperation;
import org.apache.wss4j.common.ext.WSSecurityException;
-import org.springframework.context.ApplicationEvent;
/**
* An implementation of the IssueOperation interface to renew tokens.
@@ -184,7 +183,7 @@ public class TokenRenewOperation extends
createResponse(
encryptionProperties, tokenRenewerResponse, tokenRequirements, keyRequirements, context
);
- ApplicationEvent event = new STSRenewSuccessEvent(renewerParameters,
+ STSRenewSuccessEvent event = new STSRenewSuccessEvent(renewerParameters,
System.currentTimeMillis() - start);
publishEvent(event);
return response;
@@ -193,7 +192,7 @@ public class TokenRenewOperation extends
throw new STSException("Error in creating the response", ex, STSException.REQUEST_FAILED);
}
} catch (RuntimeException ex) {
- ApplicationEvent event = new STSRenewFailureEvent(renewerParameters,
+ STSRenewFailureEvent event = new STSRenewFailureEvent(renewerParameters,
System.currentTimeMillis() - start, ex);
publishEvent(event);
throw ex;
Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenValidateOperation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenValidateOperation.java?rev=1503576&r1=1503575&r2=1503576&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenValidateOperation.java (original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenValidateOperation.java Tue Jul 16 07:13:39 2013
@@ -52,7 +52,6 @@ import org.apache.cxf.ws.security.sts.pr
import org.apache.cxf.ws.security.sts.provider.model.StatusType;
import org.apache.cxf.ws.security.sts.provider.operation.ValidateOperation;
import org.apache.wss4j.common.ext.WSSecurityException;
-import org.springframework.context.ApplicationEvent;
/**
* An implementation of the ValidateOperation interface.
@@ -172,7 +171,7 @@ public class TokenValidateOperation exte
try {
RequestSecurityTokenResponseType response =
createResponse(tokenResponse, tokenProviderResponse, tokenRequirements);
- ApplicationEvent event = new STSValidateSuccessEvent(validatorParameters,
+ STSValidateSuccessEvent event = new STSValidateSuccessEvent(validatorParameters,
System.currentTimeMillis() - start);
publishEvent(event);
return response;
@@ -182,7 +181,7 @@ public class TokenValidateOperation exte
}
} catch (RuntimeException ex) {
- ApplicationEvent event = new STSValidateFailureEvent(validatorParameters,
+ STSValidateFailureEvent event = new STSValidateFailureEvent(validatorParameters,
System.currentTimeMillis() - start, ex);
publishEvent(event);
throw ex;
Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/provider/DefaultSecurityTokenServiceProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/provider/DefaultSecurityTokenServiceProvider.java?rev=1503576&r1=1503575&r2=1503576&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/provider/DefaultSecurityTokenServiceProvider.java (original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/provider/DefaultSecurityTokenServiceProvider.java Tue Jul 16 07:13:39 2013
@@ -26,6 +26,7 @@ import javax.xml.transform.Source;
import org.apache.cxf.sts.STSPropertiesMBean;
import org.apache.cxf.sts.claims.ClaimsManager;
+import org.apache.cxf.sts.event.STSEventListener;
import org.apache.cxf.sts.operation.AbstractOperation;
import org.apache.cxf.sts.operation.TokenIssueOperation;
import org.apache.cxf.sts.operation.TokenRenewOperation;
@@ -56,6 +57,7 @@ public class DefaultSecurityTokenService
private boolean returnReferences = true;
private TokenStore tokenStore;
private ClaimsManager claimsManager = new ClaimsManager();
+ private STSEventListener eventListener;
public DefaultSecurityTokenServiceProvider() throws Exception {
super();
@@ -85,6 +87,10 @@ public class DefaultSecurityTokenService
this.claimsManager = claimsManager;
}
+ public void setEventListener(STSEventListener listener) {
+ this.eventListener = listener;
+ }
+
@Override
public Source invoke(Source request) {
if (getIssueOperation() == null) {
@@ -141,5 +147,6 @@ public class DefaultSecurityTokenService
abstractOperation.setReturnReferences(returnReferences);
abstractOperation.setTokenStore(tokenStore);
abstractOperation.setClaimsManager(claimsManager);
+ abstractOperation.setEventListener(eventListener);
}
}
\ No newline at end of file
Modified: cxf/trunk/services/sts/sts-war/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-war/pom.xml?rev=1503576&r1=1503575&r2=1503576&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-war/pom.xml (original)
+++ cxf/trunk/services/sts/sts-war/pom.xml Tue Jul 16 07:13:39 2013
@@ -53,7 +53,7 @@
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
+ <artifactId>slf4j-jdk14</artifactId>
<version>${cxf.slf4j.version}</version>
<scope>runtime</scope>
</dependency>
Added: cxf/trunk/services/sts/sts-war/src/main/resources/logging.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-war/src/main/resources/logging.properties?rev=1503576&view=auto
==============================================================================
--- cxf/trunk/services/sts/sts-war/src/main/resources/logging.properties (added)
+++ cxf/trunk/services/sts/sts-war/src/main/resources/logging.properties Tue Jul 16 07:13:39 2013
@@ -0,0 +1,71 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+############################################################
+# Default Logging Configuration File
+#
+# You can use a different file by specifying a filename
+# with the java.util.logging.config.file system property.
+# For example java -Djava.util.logging.config.file=myfile
+############################################################
+
+############################################################
+# Global properties
+############################################################
+
+# "handlers" specifies a comma separated list of log Handler
+# classes. These handlers will be installed during VM startup.
+# Note that these classes must be on the system classpath.
+# By default we only configure a ConsoleHandler, which will only
+# show messages at the WARNING and above levels.
+handlers= java.util.logging.ConsoleHandler
+#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
+
+# Default global logging level.
+# This specifies which kinds of events are logged across
+# all loggers. For any given facility this global level
+# can be overridden by a facility specific level
+# Note that the ConsoleHandler also has a separate level
+# setting to limit messages printed to the console.
+.level= INFO
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+# default file output is in user's home directory.
+java.util.logging.FileHandler.pattern = %h/java%u.log
+java.util.logging.FileHandler.limit = 50000
+java.util.logging.FileHandler.count = 1
+java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
+
+# Limit the message that are printed on the console to WARNING and above.
+java.util.logging.ConsoleHandler.level = INFO
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+
+############################################################
+# Facility specific properties.
+# Provides extra control for each logger.
+############################################################
+
+# For example, set the com.xyz.foo logger to only log SEVERE
+# messages:
+#com.xyz.foo.level = SEVERE
Modified: cxf/trunk/services/sts/sts-war/src/main/webapp/WEB-INF/cxf-transport.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-war/src/main/webapp/WEB-INF/cxf-transport.xml?rev=1503576&r1=1503575&r2=1503576&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-war/src/main/webapp/WEB-INF/cxf-transport.xml (original)
+++ cxf/trunk/services/sts/sts-war/src/main/webapp/WEB-INF/cxf-transport.xml Tue Jul 16 07:13:39 2013
@@ -45,6 +45,7 @@
class="org.apache.cxf.sts.provider.DefaultSecurityTokenServiceProvider">
<property name="services" ref="transportService" />
<property name="stsProperties" ref="transportSTSProperties" />
+ <property name="eventListener" ref="loggerListener"/>
</bean>
<bean id="transportService" class="org.apache.cxf.sts.service.StaticService">