Skip to content

Commit

Permalink
DSS-215
Browse files Browse the repository at this point in the history
WEB-APP: Administration / proxy editing

git-svn-id: http://forge.aris-lux.lan/svn/dgmarktdss/trunk@4342 d5ae4de1-bb57-470e-99d7-fe7b0b039746
  • Loading branch information
Robert Bielecki authored and Robert Bielecki committed Jul 19, 2014
0 parents commit bcac73a
Show file tree
Hide file tree
Showing 692 changed files with 101,185 additions and 0 deletions.
111 changes: 111 additions & 0 deletions apps/dss/core/dss-common/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<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/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>eu.europa.ec.joinup.sd-dss</groupId>
<artifactId>sd-dss-app</artifactId>
<version>4.1.0</version>
<relativePath>../..</relativePath>
</parent>

<name>DSS Common</name>
<description>DSS Common contains the code used in all other modules.</description>
<groupId>eu.europa.ec.joinup.sd-dss</groupId>
<artifactId>dss-common</artifactId>
<packaging>jar</packaging>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaIncludes>
<schemaInclude>ts_sie_xsd.xsd</schemaInclude>
<schemaInclude>ts_additionaltypes_xsd.xsd</schemaInclude>
<schemaInclude>XAdESv141.xsd</schemaInclude>
</schemaIncludes>
<catalog>src/main/resources/catalog.cat</catalog>
<bindingIncludes>
<include>bindings.xjb.xml</include>
</bindingIncludes>
<specVersion>2.1</specVersion>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.jvnet.jaxb2.maven2
</groupId>
<artifactId>
maven-jaxb2-plugin
</artifactId>
<versionRange>
[0.7.5,)
</versionRange>
<goals>
<goal>generate</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>eu.europa.ec.joinup.sd-dss</groupId>
<artifactId>dss-spi</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</dependency>

</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* DSS - Digital Signature Services
*
* Copyright (C) 2013 European Commission, Directorate-General Internal Market and Services (DG MARKT), B-1049 Bruxelles/Brussel
*
* Developed by: 2013 ARHS Developments S.A. (rue Nicolas Bové 2B, L-1253 Luxembourg) http://www.arhs-developments.com
*
* This file is part of the "DSS - Digital Signature Services" project.
*
* "DSS - Digital Signature Services" is free software: you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* DSS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* "DSS - Digital Signature Services". If not, see <http://www.gnu.org/licenses/>.
*/

package eu.europa.ec.markt.dss.common;

import java.util.prefs.Preferences;

/**
* Stores the user preferences in the Java Preferences API.
*
* @version $Revision$ - $Date$
*/

public class JavaPreferencesDAO implements UserPreferencesDAO {

private static final String PKCS11LIB = "PKCS11LIB";
private static final String PKCS12FILE = "PKCS12FILE";
private static final String TOKEN_TYPE = "TOKEN_TYPE";

private Preferences getPreferences() {
return Preferences.userNodeForPackage(this.getClass());
}

@Override
public void setPKCS11LibraryPath(String pkcs11LibraryPath) {
Preferences preferences = getPreferences();
preferences.put(PKCS11LIB, pkcs11LibraryPath);
}

@Override
public String getPKCS11LibraryPath() {
Preferences preferences = getPreferences();
return preferences.get(PKCS11LIB, null);
}

@Override
public void setSignatureTokenType(SignatureTokenType tokenType) {
Preferences preferences = getPreferences();
preferences.put(TOKEN_TYPE, tokenType.toString());
}

@Override
public SignatureTokenType getSignatureTokenType() {
Preferences preferences = getPreferences();
if (preferences.get(TOKEN_TYPE, null) != null) {
return SignatureTokenType.valueOf(preferences.get(TOKEN_TYPE, null));
} else {
return null;
}
}

@Override
public void setPKCS12FilePath(String path) {
Preferences preferences = getPreferences();
preferences.put(PKCS12FILE, path);
}

@Override
public String getPKCS12FilePath() {
Preferences preferences = getPreferences();
return preferences.get(PKCS12FILE, null);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
/*
* DSS - Digital Signature Services
*
* Copyright (C) 2013 European Commission, Directorate-General Internal Market and Services (DG MARKT), B-1049 Bruxelles/Brussel
*
* Developed by: 2013 ARHS Developments S.A. (rue Nicolas Bové 2B, L-1253 Luxembourg) http://www.arhs-developments.com
*
* This file is part of the "DSS - Digital Signature Services" project.
*
* "DSS - Digital Signature Services" is free software: you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* DSS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* "DSS - Digital Signature Services". If not, see <http://www.gnu.org/licenses/>.
*/

package eu.europa.ec.markt.dss.common;

import eu.europa.ec.markt.dss.signature.token.PasswordInputCallback;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;

/**
* Holds the implementation of some eID related dialogs.
*
*
* @version $Revision$ - $Date$
*/

@SuppressWarnings("serial")
public class PinInputDialog extends JDialog implements PasswordInputCallback {

static enum Result {
OK, CANCEL
};

public static final int MIN_PIN_SIZE = 4;

public static final int MAX_PIN_SIZE = 12;

private final Component view;

private Result result = null;

private JPanel mainPanel;
private JButton okButton;
private JPanel buttonPanel;
private JButton cancelButton;
private JPasswordField passwordField;

/**
* Create a Dialog with the provided parent The default constructor for Dialogs.
*
* @param view
*/
public PinInputDialog(Component view) {
super((Frame) null, true);
this.view = view;
initComponents();

/* If the user press the OK button */
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
result = Result.OK;
dispose();
}
});
okButton.setName("ok");

/* If the user press the CANCEL button */
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
result = Result.CANCEL;
dispose();
}
});

/* If the user press enter */
passwordField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
int pinSize = passwordField.getPassword().length;
if (MIN_PIN_SIZE <= pinSize && pinSize <= MAX_PIN_SIZE) {
result = Result.OK;
dispose();
}
}
});
passwordField.setName("password");

passwordField.addKeyListener(new KeyListener() {

public void keyPressed(KeyEvent e) {
}

public void keyReleased(KeyEvent e) {
int pinSize = passwordField.getPassword().length;
if (MIN_PIN_SIZE <= pinSize && pinSize <= MAX_PIN_SIZE) {
okButton.setEnabled(true);
} else {
okButton.setEnabled(false);
}
}

public void keyTyped(KeyEvent e) {
}
});
}

private void initComponents() {

// main panel
mainPanel = new JPanel() {
private static final long serialVersionUID = 1L;

private static final int BORDER_SIZE = 20;

@Override
public Insets getInsets() {
return new Insets(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE);
}
};
BoxLayout boxLayout = new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS);
mainPanel.setLayout(boxLayout);

/* Fields */
Box passwordPanel = Box.createHorizontalBox();
JLabel promptLabel = new JLabel("Pin code : ");
passwordPanel.add(promptLabel);
passwordPanel.add(Box.createHorizontalStrut(5));
passwordField = new JPasswordField(MAX_PIN_SIZE);
promptLabel.setLabelFor(passwordField);
passwordPanel.add(passwordField);
mainPanel.add(passwordPanel);

// button panel
buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)) {
private static final long serialVersionUID = 1L;

@Override
public Insets getInsets() {
return new Insets(0, 0, 5, 5);
}
};

okButton = new JButton("Ok");
okButton.setEnabled(false);
buttonPanel.add(okButton);
cancelButton = new JButton("Cancel");
buttonPanel.add(cancelButton);

setLayout(new BorderLayout());
getContentPane().add(mainPanel, BorderLayout.CENTER);
getContentPane().add(buttonPanel, BorderLayout.SOUTH);

pack();
}

/**
* Display a dialog that retrieves a pin code
*
* @return
*/
@Override
public char[] getPassword() {

setLocationRelativeTo(view);
setVisible(true);

if (result == Result.OK) {
char[] pin = passwordField.getPassword();
return pin;
}

throw new RuntimeException("operation canceled.");
}

}
Loading

0 comments on commit bcac73a

Please sign in to comment.