Skip to content

Commit

Permalink
Merge pull request #198 from arjantijms/tck_migrate_old_soap
Browse files Browse the repository at this point in the history
Initial copy of SOAP classes. Doesn't include tests yet.
  • Loading branch information
arjantijms committed Apr 16, 2024
2 parents 97611c2 + dfc059d commit 9ad338d
Show file tree
Hide file tree
Showing 16 changed files with 2,798 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tck/old-tck/run/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
<tck-setting key="orb.port" value="${port.orb}"/>
<tck-setting key="wsgen.ant.classname" value="com.sun.tools.ws.ant.WsGen"/>
<tck-setting key="wsimport.ant.classname" value="com.sun.tools.ws.ant.WsImport"/>
<tck-setting key="vendor.authconfig.factory" value="org.omnifaces.eleos.config.factory.file.AuthConfigFileFactory"/>
<tck-setting key="vendor.authconfig.factory" value="com.sun.ts.tests.jaspic.tssv.config.TSAuthConfigProviderStandalone"/>

<tck-setting key="report.dir" value="${tck.home}/authenticationtckreport/authenticationtck"/>
<tck-setting key="work.dir" value="${tck.home}/authenticationtckwork/authenticationtck"/>
Expand Down
52 changes: 52 additions & 0 deletions tck/profile-spi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,26 @@
<artifactId>jaspic-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>jakarta.jws</groupId>
<artifactId>jakarta.jws-api</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>jakarta.xml.ws</groupId>
<artifactId>jakarta.xml.ws-api</artifactId>
<version>4.0.2</version>
</dependency>
<dependency>
<groupId>jakarta.xml.soap</groupId>
<artifactId>jakarta.xml.soap-api</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.epicyro</groupId>
<artifactId>epicyro</artifactId>
Expand Down Expand Up @@ -88,5 +103,42 @@
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<!-- wsimport for web service classes generation -->
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>4.0.2</version>

<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<!--
Generates JAX-WS portable artifacts used in JAX-WS clients and services.
This goal reads WSDL files and generates the required artifacts for web service development,
deployment, and invocation.
-->
<goal>wsimport</goal>
</goals>
<configuration>
<packageName>ee.jakarta.tck.authentication.test.basic.soap</packageName>

<!-- For convenience, use a pre-copied wsdl file instead of requesting it from the server -->
<wsdlFiles>
<wsdlFile>${basedir}/src/main/webapp/WEB-INF/HelloService.wsdl</wsdlFile>
</wsdlFiles>
<!-- Set the location in the generated Java files as-if we had fetched the wsdl file from the server -->
<wsdlLocation>http://localhost:8080/jaxws-endpoint/EBookStoreImplService?wsdl</wsdlLocation>

<verbose>true</verbose>
<sourceDestDir>${basedir}/src/main/java</sourceDestDir>
<target>3.0</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/*
* Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package ee.jakarta.tck.authentication.test.basic.sam.module.soap;

import ee.jakarta.tck.authentication.test.common.logging.server.TSLogger;
import java.io.IOException;
import java.util.logging.Level;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.UnsupportedCallbackException;

/**
*
* @author Raja Perumal
*/
public class ClientCallbackSupport {
private static TSLogger logger;

private static CallbackHandler callbackHandler;

private static String profile;

private static final String runtimeType = "ClientRuntime";

/** Creates a new instance of ClientCallbackSupport */
public ClientCallbackSupport(TSLogger tsLogger, CallbackHandler cbkHandler, String profile) {
logger = tsLogger;
callbackHandler = cbkHandler;
this.profile = profile;
}

public boolean verify() {
try {
NameCallbackSupport();
PasswordCallbackSupport();
return true;

} catch (Exception e) {
return false;
}
}

private void NameCallbackSupport() {
if (callbackHandler != null) {
try {
NameCallback nameCallback = new NameCallback("Please enter your name :", "j2ee");
nameCallback.setName("j2ee");

Callback[] callbacks = new Callback[] { nameCallback };

callbackHandler.handle(callbacks);
String returnedName = nameCallback.getName();

if (returnedName != null) {
logMsg("Name returned from Name Callback =" + returnedName);
}
logMsg("CallbackHandler supports NameCallback");
} catch (UnsupportedCallbackException usce) {
logMsg("CallbackHandler failed to support NameCallback :" + usce.getMessage());
usce.printStackTrace();
} catch (IOException ioe) {
logMsg("CallbackHandler failed to support NameCallback :" + ioe.getMessage());
ioe.printStackTrace();
}
}

}

private void PasswordCallbackSupport() {
if (callbackHandler != null) {
try {
PasswordCallback passwordCallback = new PasswordCallback("Please enter your password :", false);
passwordCallback.setPassword(new char[] { 'j', '2', 'e', 'e' });

Callback[] callbacks = new Callback[] { passwordCallback };

callbackHandler.handle(callbacks);
char returnedPassword[] = passwordCallback.getPassword();

if (returnedPassword != null) {
logMsg("Password returned from Password Callback =" + new String(returnedPassword));
}
logMsg("CallbackHandler supports PasswordCallback");
} catch (UnsupportedCallbackException usce) {
logMsg("CallbackHandler failed to support PasswordCallback :" + usce.getMessage());
usce.printStackTrace();
} catch (IOException ioe) {
logMsg("CallbackHandler failed to support PasswordCallback :" + ioe.getMessage());
ioe.printStackTrace();
}

}

}

public void logMsg(String str) {
if (logger != null) {
logger.log(Level.INFO, "In " + profile + " : " + runtimeType + " " + str);
} else {
System.out.println("*** TSLogger Not Initialized properly ***");
System.out.println("*** TSSVLogMessage : ***" + str);
}
}

}

0 comments on commit 9ad338d

Please sign in to comment.