Skip to content

Commit

Permalink
- New multijar version
Browse files Browse the repository at this point in the history
  • Loading branch information
kterry committed Dec 9, 2014
1 parent 9d34a07 commit 8db5696
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 56 deletions.
85 changes: 84 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>getESGFCredentials</groupId>
<artifactId>getESGFCredentials</artifactId>
<packaging>jar</packaging>
<version>0.0.1</version>
<version>0.0.2</version>
<name>getESGFCredentials</name>

<build>
Expand All @@ -22,12 +22,16 @@
<artifactId>maven-shade-plugin</artifactId>
<version>2.1</version>
<executions>

<!-- Jar with two libraries -->
<execution>
<id>build-getESGFCredentialsMultLib</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>getESGFCredentialsMultLib-${project.version}</finalName>
<minimizeJar>true</minimizeJar>
<filters>
<filter>
Expand Down Expand Up @@ -65,6 +69,85 @@
</transformers>
</configuration>
</execution>

<!-- Jar with one library. MyproxyLogon lib -->
<execution>
<id>build-getESGFCredentials</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>

<finalName>getESGFCredentials-${project.version}</finalName>

<artifactSet>
<excludes>
<exclude>org.jglobus:myproxy</exclude>
<exclude>org.jglobus:gss</exclude>
<exclude>org.jglobus:jsse</exclude>
<exclude>org.jglobus:ssl-proxies</exclude>
<exclude>commons-logging:commons-logging</exclude>
<exclude>commons-io:commons-io</exclude>
</excludes>
</artifactSet>

<minimizeJar>true</minimizeJar>

<filters>
<filter>
<artifact>org.bouncycastle:bcprov-jdk16</artifact>
<excludes>
<exclude>org/bouncycastle/crypto/**</exclude>
<exclude>org/bouncycastle/math/**</exclude>
<exclude>org/bouncycastle/x509/**</exclude>
<exclude>org/bouncycastle/asn1/bc/**</exclude>
<exclude>org/bouncycastle/asn1/iana/**</exclude>
<exclude>org/bouncycastle/asn1/isismtt/**</exclude>
<exclude>org/bouncycastle/asn1/misc/**</exclude>
<exclude>org/bouncycastle/asn1/sec/**</exclude>
<exclude>org/bouncycastle/asn1/util/**</exclude>
<exclude>org/bouncycastle/jce/exception/**</exclude>
<exclude>org/bouncycastle/jce/interfaces/**</exclude>
<exclude>org/bouncycastle/jce/provider/**</exclude>
<exclude>org/bouncycastle/jce/spec/**</exclude>
<exclude>org/bouncycastle/jce/ECGOST3410NamedCurveTable**</exclude>
<exclude>org/bouncycastle/jce/PrincipalUtil**</exclude>
<exclude>org/bouncycastle/jce/ProviderConfigurationPermission**</exclude>
<exclude>org/bouncycastle/jce/X509LDAP**</exclude>
<exclude>org/bouncycastle/asn1/x509/Att**</exclude>
<exclude>org/bouncycastle/asn1/x509/B**</exclude>
<exclude>org/bouncycastle/asn1/x509/C**</exclude>
<exclude>org/bouncycastle/asn1/x509/D**</exclude>
<exclude>org/bouncycastle/asn1/x509/G**</exclude>
<exclude>org/bouncycastle/asn1/x509/H**</exclude>
<exclude>org/bouncycastle/asn1/x509/I**</exclude>
<exclude>org/bouncycastle/asn1/x509/K**</exclude>
<exclude>org/bouncycastle/asn1/x509/N**</exclude>
<exclude>org/bouncycastle/asn1/x509/O**</exclude>
<exclude>org/bouncycastle/asn1/x509/P**</exclude>
<exclude>org/bouncycastle/asn1/x509/R**</exclude>
<exclude>org/bouncycastle/asn1/x509/T**</exclude>
<exclude>org/bouncycastle/asn1/x509/V**</exclude>
</excludes>
</filter>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>es.unican.meteo.esgf.myproxyclient.CredentialsProviderGUI</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ private static void createInstance() {
}

/**
* Get singleton instance of {@link CredentialsProvider}. This instance
* is the only that exists.
* Get singleton instance of {@link CredentialsProvider}. This instance is
* the only that exists.
*
* @return the unique instance of {@link ESGFCredentialsProviders}.
*/
Expand Down Expand Up @@ -824,12 +824,12 @@ private void getCASCertificates() throws IOException, ArchiveException {
} else { // if CA's can't be retrieved check if exists CA's
// previously download in caDirectory
File caDirectory = new File(this.caDirectory);
if (!caDirectory.exists() | caDirectory.isDirectory()) {
if (!caDirectory.exists() | !caDirectory.isDirectory()) {
LOG.error("CA's can't be retrieved from {} and can't"
+ " be loaded from {} in file system",
ESGF_CA_CERTS_URL, caDirectory);
throw new IOException("CA's can't be retrieved from "
+ ESGF_CA_CERTS_URL + "and can't be loaded from"
+ ESGF_CA_CERTS_URL + " and can't be loaded from"
+ caDirectory + " in file system");
}

Expand All @@ -839,7 +839,7 @@ private void getCASCertificates() throws IOException, ArchiveException {
+ " because CA's directory is empty",
ESGF_CA_CERTS_URL, caDirectory);
throw new IOException("CA's can't be retrieved from "
+ ESGF_CA_CERTS_URL + "and can't be loaded from"
+ ESGF_CA_CERTS_URL + " and can't be loaded from"
+ caDirectory + " in file system because CA's"
+ " directory is empty");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ public class CredentialsProviderGUI extends JFrame {
private JTextField userField;
private JPasswordField passField;

public CredentialsProviderGUI(
CredentialsProvider credentialsProvider)
public CredentialsProviderGUI(CredentialsProvider credentialsProvider)
throws HeadlessException {
super("ESGF MyProxy service client");

Expand Down Expand Up @@ -225,6 +224,15 @@ private void addMessage(String message) {
* @return
*/
private JPanel generateIdPanel() {

boolean multLibraries = false;
try {
this.getClass().getClassLoader()
.loadClass("org.globus.myproxy.MyProxy");
multLibraries = true;
} catch (ClassNotFoundException e) {
}

JPanel idPanel = new JPanel(new BorderLayout());
final JPanel introPanel = new JPanel(new GridBagLayout());

Expand Down Expand Up @@ -351,21 +359,79 @@ public void itemStateChanged(ItemEvent e) {

// Options of MyProxy Lib in idpPanel
JPanel idLibOptsPanel = new JPanel(new GridLayout(4, 1));
final JRadioButton rbMyProxyLogon = new JRadioButton(
"use MyProxyLogon lib (v-1.0)");
rbMyProxyLogon.setSelected(true);
final JRadioButton rbMyProxy206 = new JRadioButton(
"use MyProxy lib (v-2.0.6)");
final ButtonGroup myProxyGroup = new ButtonGroup(); // radio button
// group
myProxyGroup.add(rbMyProxyLogon);
myProxyGroup.add(rbMyProxy206);
idLibOptsPanel.add(rbMyProxyLogon);
idLibOptsPanel.add(rbMyProxy206);
idLibOptsPanel.add(new JLabel(" "));
idLibOptsPanel.add(chkBootstrap);
idLibOptsPanel.setBorder(BorderFactory
.createTitledBorder("Select lib:"));
if (multLibraries) {
final JRadioButton rbMyProxyLogon = new JRadioButton(
"use MyProxyLogon lib (v-1.0)");
rbMyProxyLogon.setSelected(true);

final JRadioButton rbMyProxy206 = new JRadioButton(
"use MyProxy lib (v-2.0.6)");
final ButtonGroup myProxyGroup = new ButtonGroup(); // radio button
// group
myProxyGroup.add(rbMyProxyLogon);
myProxyGroup.add(rbMyProxy206);
idLibOptsPanel.add(rbMyProxyLogon);
idLibOptsPanel.add(rbMyProxy206);
idLibOptsPanel.add(new JLabel(" "));
idLibOptsPanel.add(chkBootstrap);
idLibOptsPanel.setBorder(BorderFactory
.createTitledBorder("Select lib:"));

// opts listener
ActionListener optsListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent paramActionEvent) {
JRadioButton source = (JRadioButton) paramActionEvent
.getSource();
if (source == rbEsgFol) {
credentialsProvider.resetCredentialsDirectory();
btChangeCredFol.setEnabled(false);
rbAnotherFol.setText("Another folder");
} else if (source == rbAnotherFol) {
btChangeCredFol.setEnabled(true);
} else if (source == rbMyProxyLogon) {
credentialsProvider
.setMyProxyLib(CredentialsProvider.Lib.MYPROXYLOGON);
chkBootstrap.setSelected(false);
chkBootstrap.setEnabled(true);
} else if (source == rbMyProxy206) {
credentialsProvider // always bootstrap
.setMyProxyLib(CredentialsProvider.Lib.MYPROXYV206);
chkBootstrap.setSelected(true);
chkBootstrap.setEnabled(false);
}
}
};

// addListeners to radio buttons
rbEsgFol.addActionListener(optsListener);
rbAnotherFol.addActionListener(optsListener);
rbMyProxyLogon.addActionListener(optsListener);
rbMyProxy206.addActionListener(optsListener);
} else {
idLibOptsPanel.add(chkBootstrap);
idLibOptsPanel.setBorder(BorderFactory
.createTitledBorder("Bootstrapping:"));

// opts listener
ActionListener optsListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent paramActionEvent) {
JRadioButton source = (JRadioButton) paramActionEvent
.getSource();
if (source == rbEsgFol) {
credentialsProvider.resetCredentialsDirectory();
btChangeCredFol.setEnabled(false);
rbAnotherFol.setText("Another folder");
} else if (source == rbAnotherFol) {
btChangeCredFol.setEnabled(true);
}
}
};

rbEsgFol.addActionListener(optsListener);
rbAnotherFol.addActionListener(optsListener);
}

// button listener
btChangeCredFol.addActionListener(new ActionListener() {
Expand All @@ -386,37 +452,6 @@ public void actionPerformed(ActionEvent paramActionEvent) {
}
});

// opts listener
ActionListener idOptionsListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent paramActionEvent) {
JRadioButton source = (JRadioButton) paramActionEvent
.getSource();
if (source == rbEsgFol) {
credentialsProvider.resetCredentialsDirectory();
btChangeCredFol.setEnabled(false);
rbAnotherFol.setText("Another folder");
} else if (source == rbAnotherFol) {
btChangeCredFol.setEnabled(true);
} else if (source == rbMyProxyLogon) {
credentialsProvider
.setMyProxyLib(CredentialsProvider.Lib.MYPROXYLOGON);
chkBootstrap.setSelected(false);
chkBootstrap.setEnabled(true);
} else if (source == rbMyProxy206) {
credentialsProvider // always bootstrap
.setMyProxyLib(CredentialsProvider.Lib.MYPROXYV206);
chkBootstrap.setSelected(true);
chkBootstrap.setEnabled(false);
}
}
};

// addListeners to radio buttons
rbEsgFol.addActionListener(idOptionsListener);
rbAnotherFol.addActionListener(idOptionsListener);
rbMyProxyLogon.addActionListener(idOptionsListener);
rbMyProxy206.addActionListener(idOptionsListener);
// panel of idp options
JPanel optsPanel = new JPanel(new BorderLayout());
optsPanel.add(idFolOptsPanel, BorderLayout.CENTER);
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/authtest.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
auth.openid = none
auth.password = none
auth.openid = https://pcmdi9.llnl.gov/esgf-idp/openid/terryK
auth.password = 168710

0 comments on commit 8db5696

Please sign in to comment.