http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/FederationAuthenticator.java ---------------------------------------------------------------------- diff --git a/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/FederationAuthenticator.java b/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/FederationAuthenticator.java deleted file mode 100644 index 6b39c13..0000000 --- a/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/FederationAuthenticator.java +++ /dev/null @@ -1,435 +0,0 @@ -/** - * 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. - */ - -package org.apache.cxf.fediz.tomcat7; - -import java.io.File; -import java.io.IOException; -import java.security.Principal; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.xml.bind.JAXBException; - -import org.w3c.dom.Element; - -import org.apache.catalina.LifecycleException; -import org.apache.catalina.Session; -import org.apache.catalina.authenticator.Constants; -import org.apache.catalina.authenticator.FormAuthenticator; -import org.apache.catalina.authenticator.SavedRequest; -import org.apache.catalina.connector.Request; -import org.apache.catalina.connector.Response; -import org.apache.catalina.deploy.LoginConfig; -import org.apache.cxf.fediz.core.FederationConstants; -import org.apache.cxf.fediz.core.FedizPrincipal; -import org.apache.cxf.fediz.core.config.FedizConfigurator; -import org.apache.cxf.fediz.core.config.FedizContext; -import org.apache.cxf.fediz.core.exception.ProcessingException; -import org.apache.cxf.fediz.core.handler.LogoutHandler; -import org.apache.cxf.fediz.core.metadata.MetadataDocumentHandler; -import org.apache.cxf.fediz.core.processor.FedizProcessor; -import org.apache.cxf.fediz.core.processor.FedizProcessorFactory; -import org.apache.cxf.fediz.core.processor.FedizResponse; -import org.apache.cxf.fediz.core.processor.RedirectionResponse; -import org.apache.cxf.fediz.tomcat7.handler.TomcatLogoutHandler; -import org.apache.cxf.fediz.tomcat7.handler.TomcatSigninHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class FederationAuthenticator extends FormAuthenticator { - - public static final String SESSION_SAVED_REQUEST_PREFIX = "SAVED_REQUEST_"; - public static final String SESSION_SAVED_URI_PREFIX = "SAVED_URI_"; - public static final String FEDERATION_NOTE = "org.apache.cxf.fediz.tomcat.FEDERATION"; - public static final String REQUEST_STATE = "org.apache.cxf.fediz.REQUEST_STATE"; - public static final String SECURITY_TOKEN = "org.apache.fediz.SECURITY_TOKEN"; - - /** - * Descriptive information about this implementation. - */ - protected static final String INFO = "org.apache.cxf.fediz.tomcat.WsFedAuthenticator/1.0"; - protected static final String TRUSTED_ISSUER = "org.apache.cxf.fediz.tomcat.TRUSTED_ISSUER"; - - private static final Logger LOG = LoggerFactory.getLogger(FormAuthenticator.class); - - /** - * Fediz Configuration file - */ - protected String configFile; - protected String encoding = "UTF-8"; - - private FedizConfigurator configurator; - - public FederationAuthenticator() { - LOG.debug("WsFedAuthenticator()"); - } - - /** - * Return descriptive information about this Valve implementation. - */ - @Override - public String getInfo() { - return INFO; - } - - public String getConfigFile() { - return configFile; - } - - public void setConfigFile(String configFile) { - this.configFile = configFile; - } - - public String getEncoding() { - return encoding; - } - - public void setEncoding(String encoding) { - this.encoding = encoding; - } - - @Override - protected synchronized void startInternal() throws LifecycleException { - - try { - File f = new File(getConfigFile()); - if (!f.exists()) { - String catalinaBase = System.getProperty("catalina.base"); - if (catalinaBase != null && catalinaBase.length() > 0) { - f = new File(catalinaBase.concat(File.separator + getConfigFile())); - } - } - configurator = new FedizConfigurator(); - configurator.loadConfig(f); - LOG.debug("Fediz configuration read from " + f.getAbsolutePath()); - } catch (JAXBException | IOException e) { - throw new LifecycleException("Failed to load Fediz configuration", e); - } - super.startInternal(); - - } - - @Override - protected synchronized void stopInternal() throws LifecycleException { - if (configurator != null) { - List<FedizContext> fedContextList = configurator.getFedizContextList(); - if (fedContextList != null) { - for (FedizContext fedContext : fedContextList) { - try { - fedContext.close(); - } catch (IOException ex) { - // - } - } - } - } - super.stopInternal(); - } - - protected synchronized FedizContext getContextConfiguration(String contextName) { - if (configurator == null) { - throw new IllegalStateException("No Fediz configuration available"); - } - FedizContext config = configurator.getFedizContext(contextName); - if (config == null) { - throw new IllegalStateException("No Fediz configuration for context :" + contextName); - } - String catalinaBase = System.getProperty("catalina.base"); - if (catalinaBase != null && catalinaBase.length() > 0) { - config.setRelativePath(catalinaBase); - } - return config; - } - - @Override - public void invoke(final Request request, final Response response) throws IOException, ServletException { - - LOG.debug("WsFedAuthenticator:invoke()"); - request.setCharacterEncoding(this.encoding); - - String contextName = request.getServletContext().getContextPath(); - if (contextName == null || contextName.isEmpty()) { - contextName = "/"; - } - FedizContext fedConfig = getContextConfiguration(contextName); - - MetadataDocumentHandler mdHandler = new MetadataDocumentHandler(fedConfig); - if (mdHandler.canHandleRequest(request)) { - mdHandler.handleRequest(request, response); - return; - } - - LogoutHandler logoutHandler = new TomcatLogoutHandler(fedConfig, contextName, request); - if (logoutHandler.canHandleRequest(request)) { - Element token = (Element)request.getSession().getAttribute(SECURITY_TOKEN); - logoutHandler.setToken(token); - logoutHandler.handleRequest(request, response); - return; - } - - super.invoke(request, response); - } - - @Override - public boolean authenticate(Request request, HttpServletResponse response, - LoginConfig config) throws IOException { - - LOG.debug("authenticate invoked"); - - String contextName = request.getServletContext().getContextPath(); - if (contextName == null || contextName.isEmpty()) { - contextName = "/"; - } - LOG.debug("reading configuration for context path: {}", contextName); - FedizContext fedCtx = getContextConfiguration(contextName); - - // Handle Signin requests - TomcatSigninHandler signinHandler = new TomcatSigninHandler(fedCtx); - signinHandler.setLandingPage(landingPage); - if (signinHandler.canHandleRequest(request)) { - FedizPrincipal principal = signinHandler.handleRequest(request, response); - if (principal != null) { - LOG.debug("Authentication of '{}' was successful", principal); - resumeRequest(request, response); - } else { - response.sendError(HttpServletResponse.SC_UNAUTHORIZED); - } - // The actual login will take place after redirect - return false; - } - - // Is this the re-submit of the original request URI after successful - // authentication? If so, forward the *original* request instead. - if (matchRequest(request)) { - return restoreRequest(request, response); - } - - // Check if user was authenticated previously and token is still valid - if (checkUserAuthentication(request, response, fedCtx)) { - return true; - } - - LOG.info("No valid principal found in existing session. Redirecting to IDP"); - redirectToIdp(request, response, fedCtx); - return false; - } - - protected void resumeRequest(HttpServletRequest request, HttpServletResponse response) throws IOException { - String contextId = request.getParameter(FederationConstants.PARAM_CONTEXT); - if (contextId == null) { - LOG.warn("The 'wctx' parameter has not been provided back with signin request."); - response.sendError(HttpServletResponse.SC_UNAUTHORIZED); - - } else { - Session session = ((Request)request).getSessionInternal(); - String originalURL = (String)session.getNote(FederationAuthenticator.SESSION_SAVED_URI_PREFIX + contextId); - session.removeNote(FederationAuthenticator.SESSION_SAVED_URI_PREFIX + contextId); // Cleanup session - - try { - if (originalURL != null) { - LOG.debug("Restore request to {}", originalURL); - response.sendRedirect(response.encodeRedirectURL(originalURL)); - } else { - LOG.debug("User took so long to log on the session expired"); - if (landingPage == null) { - response.sendError(HttpServletResponse.SC_REQUEST_TIMEOUT, sm - .getString("authenticator.sessionExpired")); - } else { - // Redirect to landing page - String uri = request.getContextPath() + landingPage; - response.sendRedirect(response.encodeRedirectURL(uri)); - } - } - } catch (IOException e) { - LOG.error("Cannot resume with request.", e.getMessage()); - } - } - } - - protected boolean restoreRequest(Request request, HttpServletResponse response) throws IOException { - - Session session = request.getSessionInternal(); - LOG.debug("Restore request from session '{}'", session.getIdInternal()); - - // Get principal from session, register, and then remove it - Principal principal = (Principal)session.getNote(Constants.FORM_PRINCIPAL_NOTE); - register(request, response, principal, FederationConstants.WSFED_METHOD, null, null); - request.removeNote(Constants.FORM_PRINCIPAL_NOTE); - - if (restoreRequest(request)) { - LOG.debug("Proceed to restored request"); - return true; - } else { - LOG.warn("Restore of original request failed"); - response.sendError(HttpServletResponse.SC_BAD_REQUEST); - return false; - } - } - - protected void redirectToIdp(Request request, HttpServletResponse response, FedizContext fedCtx) - throws IOException { - - FedizProcessor processor = FedizProcessorFactory.newFedizProcessor(fedCtx.getProtocol()); - try { - RedirectionResponse redirectionResponse = processor.createSignInRequest(request, fedCtx); - String redirectURL = redirectionResponse.getRedirectionURL(); - if (redirectURL != null) { - Map<String, String> headers = redirectionResponse.getHeaders(); - if (!headers.isEmpty()) { - for (Entry<String, String> entry : headers.entrySet()) { - response.addHeader(entry.getKey(), entry.getValue()); - } - } - - // Save original request in our session - try { - saveRequest(request, redirectionResponse.getRequestState().getState()); - } catch (IOException ioe) { - LOG.debug("Request body too big to save during authentication"); - response.sendError(HttpServletResponse.SC_FORBIDDEN, sm - .getString("authenticator.requestBodyTooBig")); - } - - response.sendRedirect(redirectURL); - } else { - LOG.warn("Failed to create SignInRequest."); - response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to create SignInRequest."); - } - } catch (ProcessingException ex) { - LOG.warn("Failed to create SignInRequest: {}", ex.getMessage()); - response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to create SignInRequest."); - } - } - - @Override - protected boolean matchRequest(Request request) { - Session session = request.getSessionInternal(false); - String uri = request.getDecodedRequestURI(); - if (session != null && uri != null) { - SavedRequest saved = (SavedRequest) session.getNote(SESSION_SAVED_REQUEST_PREFIX + uri); - if (saved != null) { - synchronized (session) { - session.setNote(Constants.FORM_REQUEST_NOTE, saved); - return super.matchRequest(request); - } - } - } - return false; - } - - protected void saveRequest(Request request, String contextId) throws IOException { - String uri = request.getDecodedRequestURI(); - Session session = request.getSessionInternal(true); - if (session != null) { - LOG.debug("Save request in session '{}'", session.getIdInternal()); - } - if (session != null && uri != null) { - SavedRequest saved; - synchronized (session) { - super.saveRequest(request, session); - saved = (SavedRequest) session.getNote(Constants.FORM_REQUEST_NOTE); - } - session.setNote(SESSION_SAVED_REQUEST_PREFIX + uri, saved); - StringBuilder sb = new StringBuilder(saved.getRequestURI()); - if (saved.getQueryString() != null) { - sb.append('?'); - sb.append(saved.getQueryString()); - } - session.setNote(SESSION_SAVED_URI_PREFIX + contextId, sb.toString()); - } - } - - protected boolean restoreRequest(Request request) throws IOException { - Session session = request.getSessionInternal(false); - String uri = request.getDecodedRequestURI(); - if (session != null && uri != null) { - SavedRequest saved = (SavedRequest)session.getNote(SESSION_SAVED_REQUEST_PREFIX + uri); - if (saved != null) { - session.removeNote(SESSION_SAVED_REQUEST_PREFIX + uri); // cleanup session - synchronized (session) { - session.setNote(Constants.FORM_REQUEST_NOTE, saved); - return super.restoreRequest(request, session); - } - } - } - return false; - } - - protected boolean checkUserAuthentication(Request request, HttpServletResponse response, FedizContext fedCtx) { - // Have we already authenticated someone? - Principal principal = request.getUserPrincipal(); - // String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE); - if (principal != null) { - LOG.debug("Already authenticated '{}'", principal.getName()); - - // Associate the session with any existing SSO session - /* - * if (ssoId != null) associate(ssoId, request.getSessionInternal(true)); - */ - - if (fedCtx.isDetectExpiredTokens()) { - // Check whether security token still valid - return validateToken(request, response, fedCtx); - } else { - LOG.debug("Token expiration not validated."); - return true; - } - } - return false; - } - - protected boolean validateToken(Request request, HttpServletResponse response, FedizContext fedConfig) { - Session session = request.getSessionInternal(); - if (session != null) { - - FedizResponse wfRes = (FedizResponse)session.getNote(FEDERATION_NOTE); - Date tokenExpires = wfRes.getTokenExpires(); - if (tokenExpires == null) { - LOG.debug("Token doesn't expire"); - return true; - } - - Date currentTime = new Date(); - if (!currentTime.after(tokenExpires)) { - return true; - } else { - LOG.warn("Token already expired. Clean up and redirect"); - - session.removeNote(FEDERATION_NOTE); - session.setPrincipal(null); - request.getSession().removeAttribute(SECURITY_TOKEN); - } - } else { - LOG.debug("Session should not be null after authentication"); - } - return false; - } - - @Override - protected String getAuthMethod() { - return FederationConstants.WSFED_METHOD; - } - -}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/FederationPrincipalImpl.java ---------------------------------------------------------------------- diff --git a/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/FederationPrincipalImpl.java b/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/FederationPrincipalImpl.java deleted file mode 100644 index 4beee9f..0000000 --- a/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/FederationPrincipalImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * 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. - */ - -package org.apache.cxf.fediz.tomcat7; - -import java.util.Collections; -import java.util.List; - -import org.w3c.dom.Element; -import org.apache.catalina.realm.GenericPrincipal; -import org.apache.cxf.fediz.core.Claim; -import org.apache.cxf.fediz.core.ClaimCollection; -import org.apache.cxf.fediz.core.FedizPrincipal; - -public class FederationPrincipalImpl extends GenericPrincipal implements FedizPrincipal { - - protected ClaimCollection claims; - protected Element loginToken; - private List<String> roles = Collections.emptyList(); - - public FederationPrincipalImpl(String username, List<String> roles, - List<Claim> claims, Element loginToken) { - super(username, null, roles); - this.claims = new ClaimCollection(claims); - this.loginToken = loginToken; - if (roles != null) { - this.roles = roles; - } - } - - public ClaimCollection getClaims() { - return this.claims; - } - - @Override - public Element getLoginToken() { - return loginToken; - } - - public List<String> getRoleClaims() { - return Collections.unmodifiableList(roles); - } - -} http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/handler/TomcatLogoutHandler.java ---------------------------------------------------------------------- diff --git a/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/handler/TomcatLogoutHandler.java b/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/handler/TomcatLogoutHandler.java deleted file mode 100644 index 69da3df..0000000 --- a/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/handler/TomcatLogoutHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * 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. - */ - -package org.apache.cxf.fediz.tomcat7.handler; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.catalina.Session; -import org.apache.catalina.connector.Request; -import org.apache.cxf.fediz.core.config.FedizContext; -import org.apache.cxf.fediz.core.handler.LogoutHandler; -import org.apache.cxf.fediz.tomcat7.FederationAuthenticator; - -public class TomcatLogoutHandler extends LogoutHandler { - private final Request request; - - public TomcatLogoutHandler(FedizContext fedConfig, String servletContextPath, Request request) { - super(fedConfig, servletContextPath); - this.request = request; - } - - @Override - protected boolean signoutCleanup(HttpServletRequest req, HttpServletResponse resp) { - // Cleanup session internal - Session session = request.getSessionInternal(); - session.removeNote(FederationAuthenticator.FEDERATION_NOTE); - session.setPrincipal(null); - super.signoutCleanup(req, resp); - request.clearCookies(); - return true; - } - - @Override - protected boolean signout(HttpServletRequest req, HttpServletResponse resp) { - // Direct Logout - Session session = request.getSessionInternal(); - session.removeNote(FederationAuthenticator.FEDERATION_NOTE); - session.setPrincipal(null); - return super.signout(req, resp); - } -} http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/handler/TomcatSigninHandler.java ---------------------------------------------------------------------- diff --git a/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/handler/TomcatSigninHandler.java b/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/handler/TomcatSigninHandler.java deleted file mode 100644 index b073624..0000000 --- a/plugins/tomcat7/src/main/java/org/apache/cxf/fediz/tomcat7/handler/TomcatSigninHandler.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * 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. - */ - -package org.apache.cxf.fediz.tomcat7.handler; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.catalina.Session; -import org.apache.catalina.authenticator.Constants; -import org.apache.catalina.connector.Request; -import org.apache.cxf.fediz.core.FedizPrincipal; -import org.apache.cxf.fediz.core.config.FedizContext; -import org.apache.cxf.fediz.core.handler.SigninHandler; -import org.apache.cxf.fediz.core.processor.FedizResponse; -import org.apache.cxf.fediz.tomcat7.FederationAuthenticator; -import org.apache.cxf.fediz.tomcat7.FederationPrincipalImpl; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class TomcatSigninHandler extends SigninHandler<FedizPrincipal> { - - private static final Logger LOG = LoggerFactory.getLogger(TomcatSigninHandler.class); - private Object landingPage; - - public TomcatSigninHandler(FedizContext fedizContext) { - super(fedizContext); - } - - @Override - protected FedizPrincipal createPrincipal(HttpServletRequest request, HttpServletResponse response, - FedizResponse wfRes) { - // Add "Authenticated" role - List<String> roles = wfRes.getRoles(); - if (roles == null || roles.isEmpty()) { - roles = Collections.singletonList("Authenticated"); - } else if (getFedizContext().isAddAuthenticatedRole()) { - roles = new ArrayList<>(roles); - roles.add("Authenticated"); - } - - // proceed creating the JAAS Subject - FedizPrincipal principal = new FederationPrincipalImpl(wfRes.getUsername(), roles, - wfRes.getClaims(), wfRes.getToken()); - - Session session = ((Request)request).getSessionInternal(); - - // Save the authenticated Principal in our session - session.setNote(Constants.FORM_PRINCIPAL_NOTE, principal); - - // Save Federation response in our session - session.setNote(FederationAuthenticator.FEDERATION_NOTE, wfRes); - - // Save Federation response in public session - request.getSession(true).setAttribute(FederationAuthenticator.SECURITY_TOKEN, wfRes.getToken()); - - LOG.debug("UserPrincipal was created successfully for {}", principal); - return principal; - } - - public Object getLandingPage() { - return landingPage; - } - - public void setLandingPage(Object landingPage) { - this.landingPage = landingPage; - } - -} http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/plugins/tomcat7/src/test/resources/logging.properties ---------------------------------------------------------------------- diff --git a/plugins/tomcat7/src/test/resources/logging.properties b/plugins/tomcat7/src/test/resources/logging.properties deleted file mode 100644 index 992a78d..0000000 --- a/plugins/tomcat7/src/test/resources/logging.properties +++ /dev/null @@ -1,52 +0,0 @@ -############################################################ -# 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 = WARNING -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 http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 861c947..6fad40d 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,6 @@ <cxf.build-utils.version>3.2.0</cxf.build-utils.version> <dbcp.version>2.1.1</dbcp.version> <easymock.version>3.4</easymock.version> - <ecj.version>4.6.1</ecj.version> <ehcache.version>2.10.3</ehcache.version> <hsqldb.version>2.3.4</hsqldb.version> <htmlunit.version>2.24</htmlunit.version> @@ -56,7 +55,6 @@ <javax.el.version>2.2</javax.el.version> <javax.validation.version>1.1.0.Final</javax.validation.version> <jericho.version>3.3</jericho.version> - <jetty8.version>8.1.22.v20160922</jetty8.version> <jetty9.version>9.3.9.v20160517</jetty9.version> <junit.version>4.12</junit.version> <kerby.version>1.0.0</kerby.version> @@ -66,7 +64,6 @@ <slf4j.version>1.7.22</slf4j.version> <spring.version>4.3.5.RELEASE</spring.version> <spring.security.version>4.2.2.RELEASE</spring.security.version> - <tomcat7.version>7.0.75</tomcat7.version> <tomcat8.version>8.5.12</tomcat8.version> <wss4j.version>2.1.9</wss4j.version> http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/custom/pom.xml ---------------------------------------------------------------------- diff --git a/systests/custom/pom.xml b/systests/custom/pom.xml index 1ab92ca..c7dbd30 100644 --- a/systests/custom/pom.xml +++ b/systests/custom/pom.xml @@ -37,25 +37,13 @@ <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> - <version>${tomcat7.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.tomcat.embed</groupId> - <artifactId>tomcat-embed-logging-juli</artifactId> - <version>${tomcat7.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.eclipse.jdt.core.compiler</groupId> - <artifactId>ecj</artifactId> - <version>${ecj.version}</version> + <version>${tomcat8.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> - <version>${tomcat7.version}</version> + <version>${tomcat8.version}</version> <scope>test</scope> </dependency> <dependency> @@ -66,7 +54,7 @@ </dependency> <dependency> <groupId>org.apache.cxf.fediz</groupId> - <artifactId>fediz-tomcat7</artifactId> + <artifactId>fediz-tomcat8</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java ---------------------------------------------------------------------- diff --git a/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java b/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java index af18315..e428425 100644 --- a/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java +++ b/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java @@ -41,7 +41,7 @@ import org.apache.catalina.startup.Tomcat; import org.apache.commons.io.IOUtils; import org.apache.cxf.fediz.core.ClaimTypes; import org.apache.cxf.fediz.integrationtests.HTTPTestUtils; -import org.apache.cxf.fediz.tomcat7.FederationAuthenticator; +import org.apache.cxf.fediz.tomcat8.FederationAuthenticator; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.wss4j.dom.engine.WSSConfig; http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/cxf/pom.xml ---------------------------------------------------------------------- diff --git a/systests/cxf/pom.xml b/systests/cxf/pom.xml index 3a33d59..d2611ad 100644 --- a/systests/cxf/pom.xml +++ b/systests/cxf/pom.xml @@ -91,25 +91,13 @@ <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> - <version>${tomcat7.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.tomcat.embed</groupId> - <artifactId>tomcat-embed-logging-juli</artifactId> - <version>${tomcat7.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.eclipse.jdt.core.compiler</groupId> - <artifactId>ecj</artifactId> - <version>${ecj.version}</version> + <version>${tomcat8.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> - <version>${tomcat7.version}</version> + <version>${tomcat8.version}</version> <scope>test</scope> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/federation/samlsso/pom.xml ---------------------------------------------------------------------- diff --git a/systests/federation/samlsso/pom.xml b/systests/federation/samlsso/pom.xml index 2cb0167..9848029 100644 --- a/systests/federation/samlsso/pom.xml +++ b/systests/federation/samlsso/pom.xml @@ -37,25 +37,13 @@ <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> - <version>${tomcat7.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.tomcat.embed</groupId> - <artifactId>tomcat-embed-logging-juli</artifactId> - <version>${tomcat7.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.eclipse.jdt.core.compiler</groupId> - <artifactId>ecj</artifactId> - <version>${ecj.version}</version> + <version>${tomcat8.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> - <version>${tomcat7.version}</version> + <version>${tomcat8.version}</version> <scope>test</scope> </dependency> <dependency> @@ -66,7 +54,7 @@ </dependency> <dependency> <groupId>org.apache.cxf.fediz</groupId> - <artifactId>fediz-tomcat7</artifactId> + <artifactId>fediz-tomcat8</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/federation/wsfed/pom.xml ---------------------------------------------------------------------- diff --git a/systests/federation/wsfed/pom.xml b/systests/federation/wsfed/pom.xml index ebd35c4..955eec4 100644 --- a/systests/federation/wsfed/pom.xml +++ b/systests/federation/wsfed/pom.xml @@ -37,25 +37,13 @@ <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> - <version>${tomcat7.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.tomcat.embed</groupId> - <artifactId>tomcat-embed-logging-juli</artifactId> - <version>${tomcat7.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.eclipse.jdt.core.compiler</groupId> - <artifactId>ecj</artifactId> - <version>${ecj.version}</version> + <version>${tomcat8.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> - <version>${tomcat7.version}</version> + <version>${tomcat8.version}</version> <scope>test</scope> </dependency> <dependency> @@ -66,7 +54,7 @@ </dependency> <dependency> <groupId>org.apache.cxf.fediz</groupId> - <artifactId>fediz-tomcat7</artifactId> + <artifactId>fediz-tomcat8</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/integrationtests/WSFedTest.java ---------------------------------------------------------------------- diff --git a/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/integrationtests/WSFedTest.java b/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/integrationtests/WSFedTest.java index ad5a097..c16bb01 100644 --- a/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/integrationtests/WSFedTest.java +++ b/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/integrationtests/WSFedTest.java @@ -45,7 +45,7 @@ import org.apache.catalina.LifecycleState; import org.apache.catalina.connector.Connector; import org.apache.catalina.startup.Tomcat; import org.apache.cxf.fediz.core.ClaimTypes; -import org.apache.cxf.fediz.tomcat7.FederationAuthenticator; +import org.apache.cxf.fediz.tomcat8.FederationAuthenticator; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; import org.junit.AfterClass; http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/idp/pom.xml ---------------------------------------------------------------------- diff --git a/systests/idp/pom.xml b/systests/idp/pom.xml index 4ec377e..1b7adb5 100644 --- a/systests/idp/pom.xml +++ b/systests/idp/pom.xml @@ -37,25 +37,13 @@ <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> - <version>${tomcat7.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.tomcat.embed</groupId> - <artifactId>tomcat-embed-logging-juli</artifactId> - <version>${tomcat7.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.eclipse.jdt.core.compiler</groupId> - <artifactId>ecj</artifactId> - <version>${ecj.version}</version> + <version>${tomcat8.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> - <version>${tomcat7.version}</version> + <version>${tomcat8.version}</version> <scope>test</scope> </dependency> <dependency> @@ -66,7 +54,7 @@ </dependency> <dependency> <groupId>org.apache.cxf.fediz</groupId> - <artifactId>fediz-tomcat7</artifactId> + <artifactId>fediz-tomcat8</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/pom.xml ---------------------------------------------------------------------- diff --git a/systests/jetty8/pom.xml b/systests/jetty8/pom.xml deleted file mode 100644 index edd7f80..0000000 --- a/systests/jetty8/pom.xml +++ /dev/null @@ -1,300 +0,0 @@ -<?xml version="1.0"?> -<!-- - 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. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.cxf.fediz</groupId> - <artifactId>fediz-systests</artifactId> - <version>2.0.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> - <groupId>org.apache.cxf.fediz.systests</groupId> - <artifactId>fediz-systests-jetty8</artifactId> - <name>Apache Fediz Systests for Jetty 8</name> - <packaging>jar</packaging> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <htmlunit.jetty8.version>2.15</htmlunit.jetty8.version> - </properties> - <dependencies> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-server</artifactId> - <version>${jetty8.version}</version> - </dependency> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-security</artifactId> - <version>${jetty8.version}</version> - </dependency> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-xml</artifactId> - <version>${jetty8.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-webapp</artifactId> - <version>${jetty8.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-jsp</artifactId> - <version>${jetty8.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>${junit.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.cxf.fediz</groupId> - <artifactId>fediz-jetty8</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.cxf.fediz.systests</groupId> - <artifactId>fediz-systests-tests</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - <scope>test</scope> - <classifier>tests</classifier> - <exclusions> - <exclusion> - <groupId>net.sourceforge.htmlunit</groupId> - <artifactId>htmlunit</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-jdk14</artifactId> - <version>${slf4j.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.hsqldb</groupId> - <artifactId>hsqldb</artifactId> - <version>${hsqldb.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>net.sourceforge.htmlunit</groupId> - <artifactId>htmlunit</artifactId> - <version>${htmlunit.jetty8.version}</version> - </dependency> - </dependencies> - <build> - <testResources> - <testResource> - <directory>src/test/resources</directory> - <filtering>true</filtering> - <includes> - <include>**/idp-server.xml</include> - <include>**/rp-*server.xml</include> - <include>**/fediz_config*.xml</include> - </includes> - </testResource> - <testResource> - <directory>src/test/resources</directory> - <filtering>false</filtering> - <excludes> - <exclude>**/idp-server.xml</exclude> - <exclude>**/rp-*server.xml</exclude> - <exclude>**/fediz_config*.xml</exclude> - </excludes> - </testResource> - </testResources> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>reserve-network-port</id> - <goals> - <goal>reserve-network-port</goal> - </goals> - <phase>initialize</phase> - <configuration> - <portNames> - <portName>idp.https.port</portName> - <portName>rp.https.port</portName> - </portNames> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>copy-idp-sts</id> - <phase>generate-resources</phase> - <goals> - <goal>copy</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>org.apache.cxf.fediz</groupId> - <artifactId>fediz-idp</artifactId> - <version>${project.version}</version> - <type>war</type> - <overWrite>true</overWrite> - <outputDirectory>target/idp/</outputDirectory> - </artifactItem> - <artifactItem> - <groupId>org.apache.cxf.fediz</groupId> - <artifactId>fediz-idp-sts</artifactId> - <version>${project.version}</version> - <type>war</type> - <overWrite>true</overWrite> - <outputDirectory>target/idp/</outputDirectory> - </artifactItem> - <artifactItem> - <groupId>org.apache.cxf.fediz.systests.webapps</groupId> - <artifactId>fediz-systests-webapps-simple</artifactId> - <version>${project.version}</version> - <type>war</type> - <overWrite>true</overWrite> - <outputDirectory>target/rp/</outputDirectory> - </artifactItem> - <artifactItem> - <groupId>org.apache.cxf.fediz.systests.webapps</groupId> - <artifactId>fediz-systests-webapps-springPreauth</artifactId> - <version>${project.version}</version> - <type>war</type> - <overWrite>true</overWrite> - <outputDirectory>target/rp/</outputDirectory> - </artifactItem> - </artifactItems> - <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename> - <overWriteSnapshots>true</overWriteSnapshots> - <overWriteIfNewer>true</overWriteIfNewer> - <stripVersion>true</stripVersion> - </configuration> - </execution> - <execution> - <id>copy-keys</id> - <phase>generate-resources</phase> - <goals> - <goal>unpack</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>org.apache.cxf.fediz.systests</groupId> - <artifactId>fediz-systests-tests</artifactId> - <version>${project.version}</version> - <classifier>tests</classifier> - <type>jar</type> - <overWrite>true</overWrite> - <outputDirectory>target/test-classes</outputDirectory> - <includes>**/*.jks</includes> - </artifactItem> - </artifactItems> - <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename> - <overWriteSnapshots>true</overWriteSnapshots> - <overWriteIfNewer>true</overWriteIfNewer> - <stripVersion>true</stripVersion> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-failsafe-plugin</artifactId> - <inherited>true</inherited> - <executions> - <execution> - <id>integration-test</id> - <phase>integration-test</phase> - <goals> - <goal>integration-test</goal> - </goals> - <configuration> - <skip>${skipTests}</skip> - <systemPropertyVariables> - <wt.headless>true</wt.headless> - <idp.https.port>${idp.https.port}</idp.https.port> - <rp.https.port>${rp.https.port}</rp.https.port> - <java.util.logging.config.file>${basedir}/target/test-classes/logging.properties</java.util.logging.config.file> - </systemPropertyVariables> - <includes> - <include>**/integrationtests/**</include> - </includes> - <argLine>-XX:MaxPermSize=512M</argLine> - </configuration> - </execution> - <execution> - <id>verify</id> - <phase>verify</phase> - <goals> - <goal>verify</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <inherited>true</inherited> - <configuration> - <excludes> - <exclude>**/integrationtests/**</exclude> - </excludes> - </configuration> - </plugin> - </plugins> - </build> - - <profiles> - <!-- Skip Jetty8 tests if we are using JDK8 --> - <profile> - <id>jdk18</id> - <activation> - <jdk>1.8</jdk> - </activation> - <build> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-failsafe-plugin</artifactId> - <inherited>true</inherited> - <configuration> - <excludes> - <exclude>**/integrationtests/**</exclude> - </excludes> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> - </profile> - </profiles> -</project> http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java ---------------------------------------------------------------------- diff --git a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java deleted file mode 100644 index d5e6aa0..0000000 --- a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * 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. - */ - -package org.apache.cxf.fediz.integrationtests; - -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.util.resource.Resource; -import org.eclipse.jetty.xml.XmlConfiguration; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; - -/** - * In this test-case, the IdP is set up to require client authentication, rather than authenticating using a - * username + password, or via Kerberos. - */ -public class ClientCertificatePreAuthSpringTest extends AbstractClientCertTests { - - static String idpHttpsPort; - static String rpHttpsPort; - - private static Server rpServer; - - @BeforeClass - public static void init() { - System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); - System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true"); - System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.webflow", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.security.web", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.security", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.cxf.fediz", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.cxf", "info"); - - idpHttpsPort = System.getProperty("idp.https.port"); - Assert.assertNotNull("Property 'idp.https.port' null", idpHttpsPort); - rpHttpsPort = System.getProperty("rp.https.port"); - Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort); - - JettyUtils.initIdpServer(); - JettyUtils.startIdpServer(); - - try { - Resource testServerConfig = Resource.newSystemResource("rp-client-cert-server.xml"); - XmlConfiguration configuration = new XmlConfiguration(testServerConfig.getInputStream()); - rpServer = (Server)configuration.configure(); - rpServer.start(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @AfterClass - public static void cleanup() { - JettyUtils.stopIdpServer(); - - if (rpServer != null && rpServer.isStarted()) { - try { - rpServer.stop(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - @Override - public String getIdpHttpsPort() { - return idpHttpsPort; - } - - @Override - public String getRpHttpsPort() { - return rpHttpsPort; - } - - @Override - public String getServletContextName() { - return "fedizspringhelloworld"; - } - -} http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java ---------------------------------------------------------------------- diff --git a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java deleted file mode 100644 index 0211c7c..0000000 --- a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * 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. - */ - -package org.apache.cxf.fediz.integrationtests; - -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.util.resource.Resource; -import org.eclipse.jetty.xml.XmlConfiguration; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; - -/** - * In this test-case, the IdP is set up to require client authentication, rather than authenticating using a - * username + password, or via Kerberos. - */ -public class ClientCertificateTest extends AbstractClientCertTests { - - static String idpHttpsPort; - static String rpHttpsPort; - - private static Server rpServer; - - @BeforeClass - public static void init() { - System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); - System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true"); - System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.webflow", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.security.web", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.security", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.cxf.fediz", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.cxf", "info"); - - idpHttpsPort = System.getProperty("idp.https.port"); - Assert.assertNotNull("Property 'idp.https.port' null", idpHttpsPort); - rpHttpsPort = System.getProperty("rp.https.port"); - Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort); - - JettyUtils.initIdpServer(); - JettyUtils.startIdpServer(); - - try { - Resource testServerConfig = Resource.newSystemResource("rp-client-cert-server.xml"); - XmlConfiguration configuration = new XmlConfiguration(testServerConfig.getInputStream()); - rpServer = (Server)configuration.configure(); - rpServer.start(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @AfterClass - public static void cleanup() { - JettyUtils.stopIdpServer(); - - if (rpServer != null && rpServer.isStarted()) { - try { - rpServer.stop(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - @Override - public String getIdpHttpsPort() { - return idpHttpsPort; - } - - @Override - public String getRpHttpsPort() { - return rpHttpsPort; - } - - @Override - public String getServletContextName() { - return "fedizhelloworld"; - } - -} http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/HOKCallbackHandler.java ---------------------------------------------------------------------- diff --git a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/HOKCallbackHandler.java b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/HOKCallbackHandler.java deleted file mode 100644 index a323696..0000000 --- a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/HOKCallbackHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * 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. - */ - -package org.apache.cxf.fediz.integrationtests; - -import java.io.IOException; - -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.UnsupportedCallbackException; - -import org.apache.cxf.fediz.core.spi.WReqCallback; - -public class HOKCallbackHandler implements CallbackHandler { - - static final String HOK_WREQ = - "<RequestSecurityToken xmlns=\"http://docs.oasis-open.org/ws-sx/ws-trust/200512\">" - + "<KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/PublicKey</KeyType>" - + "</RequestSecurityToken>"; - - public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { - for (int i = 0; i < callbacks.length; i++) { - if (callbacks[i] instanceof WReqCallback) { - WReqCallback callback = (WReqCallback) callbacks[i]; - callback.setWreq(HOK_WREQ); - } else { - throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback"); - } - } - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyPreAuthSpringTest.java ---------------------------------------------------------------------- diff --git a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyPreAuthSpringTest.java b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyPreAuthSpringTest.java deleted file mode 100644 index 961dceb..0000000 --- a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyPreAuthSpringTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * 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. - */ - -package org.apache.cxf.fediz.integrationtests; - - - -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Ignore; - - -public class JettyPreAuthSpringTest extends AbstractTests { - - static String idpHttpsPort; - static String rpHttpsPort; - - @BeforeClass - public static void init() { - System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); - System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true"); - System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.webflow", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.security.web", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.cxf.fediz", "info"); - - idpHttpsPort = System.getProperty("idp.https.port"); - Assert.assertNotNull("Property 'idp.https.port' null", idpHttpsPort); - rpHttpsPort = System.getProperty("rp.https.port"); - Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort); - - JettyUtils.initIdpServer(); - JettyUtils.startIdpServer(); - JettyUtils.initRpServer(); - JettyUtils.startRpServer(); - } - - @AfterClass - public static void cleanup() { - JettyUtils.stopIdpServer(); - JettyUtils.stopRpServer(); - } - - @Override - public String getIdpHttpsPort() { - return idpHttpsPort; - } - - @Override - public String getRpHttpsPort() { - return rpHttpsPort; - } - - @Override - public String getServletContextName() { - return "fedizspringhelloworld"; - } - - @Ignore("This tests is currently failing on Jetty") - @Override - public void testConcurrentRequests() throws Exception { - // super.testConcurrentRequests(); - } - -} http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyTest.java ---------------------------------------------------------------------- diff --git a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyTest.java b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyTest.java deleted file mode 100644 index 5fe32ba..0000000 --- a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * 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. - */ - -package org.apache.cxf.fediz.integrationtests; - -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Ignore; - - -public class JettyTest extends AbstractTests { - - static String idpHttpsPort; - static String rpHttpsPort; - - @BeforeClass - public static void init() { - System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); - System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true"); - System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.webflow", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.security.web", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.security", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.cxf.fediz", "info"); - System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.cxf", "info"); - - idpHttpsPort = System.getProperty("idp.https.port"); - Assert.assertNotNull("Property 'idp.https.port' null", idpHttpsPort); - rpHttpsPort = System.getProperty("rp.https.port"); - Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort); - - JettyUtils.initIdpServer(); - JettyUtils.startIdpServer(); - JettyUtils.initRpServer(); - JettyUtils.startRpServer(); - } - - @AfterClass - public static void cleanup() { - JettyUtils.stopIdpServer(); - JettyUtils.stopRpServer(); - } - - @Override - public String getIdpHttpsPort() { - return idpHttpsPort; - } - - @Override - public String getRpHttpsPort() { - return rpHttpsPort; - } - - @Override - public String getServletContextName() { - return "fedizhelloworld"; - } - - @Ignore("This tests is currently failing on Jetty") - @Override - public void testConcurrentRequests() throws Exception { - // super.testConcurrentRequests(); - } -} http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java ---------------------------------------------------------------------- diff --git a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java deleted file mode 100644 index f4cb9fe..0000000 --- a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * 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. - */ - -package org.apache.cxf.fediz.integrationtests; - -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.util.resource.Resource; -import org.eclipse.jetty.xml.XmlConfiguration; - -public final class JettyUtils { - - private static Server idpServer; - private static Server rpServer; - - private JettyUtils() { - } - - public static void initIdpServer() { - if (idpServer == null) { - try { - Resource testServerConfig = Resource.newSystemResource("idp-server.xml"); - XmlConfiguration configuration = new XmlConfiguration(testServerConfig.getInputStream()); - idpServer = (Server)configuration.configure(); - - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public static void startIdpServer() { - if (idpServer != null && !idpServer.isStarted()) { - try { - idpServer.start(); - - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public static void stopIdpServer() { - if (idpServer != null && idpServer.isStarted()) { - try { - idpServer.stop(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public static void initRpServer() { - initRpServer("rp-server.xml"); - } - - public static void initRpServer(String configurationFile) { - if (rpServer == null) { - try { - Resource testServerConfig = Resource.newSystemResource(configurationFile); - XmlConfiguration configuration = new XmlConfiguration(testServerConfig.getInputStream()); - rpServer = (Server)configuration.configure(); - - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public static void startRpServer() { - if (rpServer != null && !rpServer.isStarted()) { - try { - rpServer.start(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public static void stopRpServer() { - if (rpServer != null && rpServer.isStarted()) { - try { - rpServer.stop(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - -} http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e392e637/systests/jetty8/src/test/resources/fediz_config.xml ---------------------------------------------------------------------- diff --git a/systests/jetty8/src/test/resources/fediz_config.xml b/systests/jetty8/src/test/resources/fediz_config.xml deleted file mode 100644 index e1ef26b..0000000 --- a/systests/jetty8/src/test/resources/fediz_config.xml +++ /dev/null @@ -1,95 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> -<!-- Place in Tomcat conf folder or other location as designated in this sample's webapp/META-INF/context.xml file. - Keystore referenced below must have IDP STS' public cert included in it. This example re-uses the Tomcat SSL - keystore (tomcat-rp.jks) for this task; alternatively you may wish to use a Fediz-specific keystore instead. ---> -<FedizConfig> - <contextConfig name="/fedizhelloworld"> - <audienceUris> - <audienceItem>urn:org:apache:cxf:fediz:fedizhelloworld</audienceItem> - </audienceUris> - <certificateStores> - <trustManager> - <keyStore file="clienttrust.jks" password="storepass" - type="JKS" /> - </trustManager> - </certificateStores> - <trustedIssuers> - <issuer certificateValidation="PeerTrust" /> - </trustedIssuers> - <maximumClockSkew>1000</maximumClockSkew> - <signingKey keyAlias="mytomidpkey" keyPassword="tompass"> - <keyStore file="server.jks" password="tompass" type="JKS" /> - </signingKey> - <protocol xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="federationProtocolType" version="1.0.0"> - <realm>urn:org:apache:cxf:fediz:fedizhelloworld</realm> - <issuer>https://localhost:${idp.https.port}/fediz-idp/federation</issuer> - <roleDelimiter>,</roleDelimiter> - <roleURI>http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role</roleURI> - <freshness>10</freshness> - <homeRealm type="String">urn:org:apache:cxf:fediz:idp:realm-A</homeRealm> - <claimTypesRequested> - <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role" optional="false" /> - <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" optional="true" /> - <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" optional="true" /> - <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" optional="true" /> - </claimTypesRequested> - </protocol> - <logoutURL>/secure/logout</logoutURL> - <logoutRedirectTo>/index.html</logoutRedirectTo> - </contextConfig> - <contextConfig name="/fedizspringhelloworld"> - <audienceUris> - <audienceItem>urn:org:apache:cxf:fediz:fedizhelloworld</audienceItem> - </audienceUris> - <certificateStores> - <trustManager> - <keyStore file="clienttrust.jks" password="storepass" - type="JKS" /> - </trustManager> - </certificateStores> - <trustedIssuers> - <issuer certificateValidation="PeerTrust" /> - </trustedIssuers> - <maximumClockSkew>1000</maximumClockSkew> - <signingKey keyAlias="mytomidpkey" keyPassword="tompass"> - <keyStore file="server.jks" password="tompass" type="JKS" /> - </signingKey> - <protocol xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="federationProtocolType" version="1.0.0"> - <realm>urn:org:apache:cxf:fediz:fedizhelloworld</realm> - <issuer>https://localhost:${idp.https.port}/fediz-idp/federation</issuer> - <roleDelimiter>,</roleDelimiter> - <roleURI>http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role</roleURI> - <homeRealm type="String">urn:org:apache:cxf:fediz:idp:realm-A</homeRealm> - <claimTypesRequested> - <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role" optional="false" /> - <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" optional="true" /> - <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" optional="true" /> - <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" optional="true" /> - </claimTypesRequested> - </protocol> - <logoutURL>/secure/logout</logoutURL> - <logoutRedirectTo>/index.html</logoutRedirectTo> - </contextConfig> -</FedizConfig> -
