You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by dj...@apache.org on 2007/08/10 01:40:18 UTC
svn commit: r564425 [4/4] - in /directory/sandbox/djencks/triplesec-jacc2:
./ admin-api2/ admin-api2/src/main/java/org/safehaus/triplesec/admin/
admin-api2/src/main/java/org/safehaus/triplesec/admin/dao/
admin-api2/src/main/java/org/safehaus/triplesec/...
Modified: directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/UserInfoPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/UserInfoPanel.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/UserInfoPanel.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/UserInfoPanel.java Thu Aug 9 16:40:15 2007
@@ -33,9 +33,7 @@
import javax.swing.JTextField;
import org.safehaus.triplesec.admin.HauskeysUser;
-import org.safehaus.triplesec.admin.HauskeysUserModifier;
import org.safehaus.triplesec.admin.LocalUser;
-import org.safehaus.triplesec.admin.LocalUserModifier;
import org.safehaus.triplesec.admin.User;
@@ -46,7 +44,6 @@
private JTextField lastNameTextField = null;
private JPasswordField passwordField = null;
private JTextField realmTextField = null;
- private JLabel jLabel = null;
private JPasswordField confirmField = null;
private User user;
private StatusListener listener;
@@ -117,7 +114,7 @@
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(0,5,5,5);
gridBagConstraints.gridy = 3;
- jLabel = new JLabel();
+ JLabel jLabel = new JLabel();
jLabel.setText("Password Confirm:");
jLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
this.setSize(577, 272);
@@ -186,7 +183,7 @@
add( getPasswordField(), gridBagConstraints30 );
this.add(jLabel14, gridBagConstraints31);
this.add(getRealmTextField(), gridBagConstraints32);
- this.add(jLabel, gridBagConstraints);
+ this.add( jLabel, gridBagConstraints);
this.add(getConfirmField(), gridBagConstraints1);
}
@@ -258,7 +255,7 @@
}
- public void alterModifier( HauskeysUserModifier modifier )
+ public void alterModifier( HauskeysUser modifier )
{
modifier.setFirstName( firstNameTextField.getText() );
modifier.setLastName( lastNameTextField.getText() );
@@ -266,7 +263,7 @@
}
- public void alterModifier( LocalUserModifier modifier )
+ public void alterModifier( LocalUser modifier )
{
modifier.setFirstName( firstNameTextField.getText() );
modifier.setLastName( lastNameTextField.getText() );
Modified: directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/UserPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/UserPanel.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/UserPanel.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/UserPanel.java Thu Aug 9 16:40:15 2007
@@ -20,36 +20,32 @@
package org.safehaus.triplesec.admin.swing;
-import javax.swing.JPanel;
import java.awt.BorderLayout;
-
-import javax.swing.JOptionPane;
-import javax.swing.JTabbedPane;
-import javax.swing.JButton;
-import javax.swing.JTree;
-
-import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
+import javax.naming.NamingException;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
+import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
-import org.safehaus.triplesec.admin.DataAccessException;
import org.safehaus.triplesec.admin.ExternalUser;
-import org.safehaus.triplesec.admin.ExternalUserModifier;
import org.safehaus.triplesec.admin.HauskeysUser;
-import org.safehaus.triplesec.admin.HauskeysUserModifier;
import org.safehaus.triplesec.admin.LocalUser;
-import org.safehaus.triplesec.admin.LocalUserModifier;
import org.safehaus.triplesec.admin.User;
-import javax.swing.JLabel;
-import javax.swing.JCheckBox;
+import org.safehaus.triplesec.admin.persistence.PCException;
public class UserPanel extends JPanel implements StatusListener, StatusObject, KeyListener, FocusListener
@@ -79,8 +75,6 @@
private StatusListener listener = this;
private AdminFrame adminFrame = null;
- private JLabel jLabel = null;
-
private JCheckBox disabledCheckBox = null;
/**
@@ -91,18 +85,17 @@
super();
initialize();
}
-
-
+
+
public void setAdminFrame( AdminFrame adminFrame )
{
this.adminFrame = adminFrame;
this.provisioningPanel.setAdminFrame( adminFrame );
}
-
-
+
+
/**
* This method initializes this
- *
*/
private void initialize()
{
@@ -116,16 +109,16 @@
this.setLayout( new GridBagLayout() );
this.setSize( 550, 417 );
this.setBorder( javax.swing.BorderFactory.createTitledBorder( null, "Existing User",
- javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION,
- null, null ) );
+ javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION,
+ null, null ) );
this.add( getMainPanel(), gridBagConstraints );
}
/**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
+ * This method initializes jPanel
+ *
+ * @return javax.swing.JPanel
*/
private JPanel getMainPanel()
{
@@ -141,9 +134,9 @@
/**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
+ * This method initializes jPanel
+ *
+ * @return javax.swing.JPanel
*/
private JPanel getButtonPanel()
{
@@ -160,9 +153,9 @@
/**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
+ * This method initializes jButton
+ *
+ * @return javax.swing.JButton
*/
private JButton getRevertButton()
{
@@ -183,9 +176,9 @@
/**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
+ * This method initializes jButton
+ *
+ * @return javax.swing.JButton
*/
private JButton getSaveButton()
{
@@ -206,9 +199,9 @@
/**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
+ * This method initializes jPanel
+ *
+ * @return javax.swing.JPanel
*/
private JPanel getAboveButtonPanel()
{
@@ -225,9 +218,9 @@
/**
- * This method initializes jTabbedPane
- *
- * @return javax.swing.JTabbedPane
+ * This method initializes jTabbedPane
+ *
+ * @return javax.swing.JTabbedPane
*/
private JTabbedPane getCenterTabbedPane()
{
@@ -243,8 +236,8 @@
}
return centerTabbedPane;
}
-
-
+
+
public UserDependentsPanel getUserDependentsPanel()
{
if ( userDependentsPanel == null )
@@ -253,8 +246,8 @@
}
return userDependentsPanel;
}
-
-
+
+
public UserNorthPanel getUserNorthPanel()
{
if ( userNorthPanel == null )
@@ -262,7 +255,7 @@
userNorthPanel = new UserNorthPanel();
userNorthPanel.setStatusListener( this );
}
-
+
return userNorthPanel;
}
@@ -272,24 +265,24 @@
if ( generalPanel == null )
{
generalPanel = new GeneralPanel();
-
+
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.gridx = 1;
gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints2.gridy = 5;
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.gridx = 0;
- gridBagConstraints1.insets = new java.awt.Insets(0,0,0,5);
+ gridBagConstraints1.insets = new java.awt.Insets( 0, 0, 0, 5 );
gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints1.gridy = 5;
- jLabel = new JLabel();
- jLabel.setText("Disabled:");
- jLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
- generalPanel.add(jLabel, gridBagConstraints1);
- generalPanel.add(getJCheckBox(), gridBagConstraints2);
-
+ JLabel jLabel = new JLabel();
+ jLabel.setText( "Disabled:" );
+ jLabel.setHorizontalAlignment( javax.swing.SwingConstants.RIGHT );
+ generalPanel.add( jLabel, gridBagConstraints1 );
+ generalPanel.add( getJCheckBox(), gridBagConstraints2 );
+
}
-
+
return generalPanel;
}
@@ -301,7 +294,7 @@
externalLinkPanel = new ExternalLinkPanel();
externalLinkPanel.setStatusListener( this );
}
-
+
return externalLinkPanel;
}
@@ -314,7 +307,7 @@
provisioningPanel.setAdminFrame( this.adminFrame );
provisioningPanel.setStatusListener( this );
}
-
+
return provisioningPanel;
}
@@ -326,7 +319,7 @@
userInfoPanel = new UserInfoPanel();
userInfoPanel.setStatusListener( this );
}
-
+
return userInfoPanel;
}
@@ -338,15 +331,15 @@
hotpSettingsPanel = new HotpSettingsPanel();
hotpSettingsPanel.setStatusListener( this );
}
-
+
return hotpSettingsPanel;
}
/**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
+ * This method initializes jPanel
+ *
+ * @return javax.swing.JPanel
*/
private JPanel getSouthPanel()
{
@@ -355,32 +348,32 @@
southPanel = new JPanel();
southPanel.setLayout( new BorderLayout() );
southPanel.setBorder( javax.swing.BorderFactory.createTitledBorder( null, "Description",
- javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
- javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null ) );
+ javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
+ javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null ) );
southPanel.add( getDescriptionTextArea(), java.awt.BorderLayout.NORTH );
}
return southPanel;
}
-
+
/**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
+ * This method initializes jTextArea
+ *
+ * @return javax.swing.JTextArea
*/
private JTextArea getDescriptionTextArea()
{
if ( descriptionTextArea == null )
{
descriptionTextArea = new JTextArea();
- descriptionTextArea.setRows(3);
+ descriptionTextArea.setRows( 3 );
descriptionTextArea.addFocusListener( this );
descriptionTextArea.addKeyListener( this );
}
return descriptionTextArea;
}
-
+
public void checkStatus()
{
boolean upToDate = isUpToDate();
@@ -390,12 +383,12 @@
lastStatusState = upToDate;
}
}
-
-
+
+
/**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
+ * This method initializes jButton
+ *
+ * @return javax.swing.JButton
*/
private JButton getDeleteButton()
{
@@ -411,38 +404,23 @@
{
String msg = UiUtils.wrap( "This user has dependent objects. Remove all " +
"dependency relationships before attempting to delete this user.", 79 );
- JOptionPane.showMessageDialog( UserPanel.this, msg, "User has dependents!",
- JOptionPane.INFORMATION_MESSAGE );
+ JOptionPane.showMessageDialog( UserPanel.this, msg, "User has dependents!",
+ JOptionPane.INFORMATION_MESSAGE );
return;
}
-
+
try
{
- if ( user instanceof ExternalUser )
- {
- ( ( ExternalUser ) user ).modifier().delete();
- }
- else if ( user instanceof LocalUser )
- {
- ( ( LocalUser ) user ).modifier().delete();
- }
- else if ( user instanceof HauskeysUser )
- {
- ( ( HauskeysUser ) user ).modifier().delete();
- }
- else
- {
- throw new IllegalStateException( "Unknown user type: " + user.getClass() );
- }
+ user.getStateManager().getEntityManager().remove( user );
DefaultMutableTreeNode parentNode = ( DefaultMutableTreeNode ) node.getParent();
DefaultTreeModel treeModel = ( DefaultTreeModel ) tree.getModel();
treeModel.removeNodeFromParent( node );
TreePath path = new TreePath( parentNode.getPath() );
tree.setSelectionPaths( new TreePath[]
- { path } );
+ {path} );
}
- catch ( DataAccessException e1 )
+ catch ( PCException e1 )
{
String msg = UiUtils.wrap( "Failed to delete user: " + e1.getMessage(), 79 );
JOptionPane.showMessageDialog( UserPanel.this, msg, "Delete Failed", JOptionPane.ERROR_MESSAGE );
@@ -456,7 +434,7 @@
private void setUserFields()
{
- generalPanel.setFields( user );
+// generalPanel.setFields( user );
disabledCheckBox.setSelected( user.isDisabled() );
userNorthPanel.setFields( user );
@@ -468,18 +446,7 @@
centerTabbedPane.remove( provisioningPanel );
centerTabbedPane.remove( hotpSettingsPanel );
externalLinkPanel.setFields( externalUser );
- }
- else if ( user instanceof LocalUser )
- {
- LocalUser localUser = ( LocalUser ) user;
- centerTabbedPane.remove( externalLinkPanel );
- centerTabbedPane.remove( provisioningPanel );
- centerTabbedPane.remove( hotpSettingsPanel );
- centerTabbedPane.remove( userInfoPanel );
- centerTabbedPane.addTab( "User Info", null, userInfoPanel, null );
- userInfoPanel.setFields( localUser, "not implemented" );
- }
- else if ( user instanceof HauskeysUser )
+ } else if ( user instanceof HauskeysUser )
{
HauskeysUser hauskeysUser = ( HauskeysUser ) user;
centerTabbedPane.remove( externalLinkPanel );
@@ -490,6 +457,15 @@
userInfoPanel.setFields( hauskeysUser );
hotpSettingsPanel.setFields( hauskeysUser );
provisioningPanel.setFields( hauskeysUser );
+ } else if ( user instanceof LocalUser )
+ {
+ LocalUser localUser = ( LocalUser ) user;
+ centerTabbedPane.remove( externalLinkPanel );
+ centerTabbedPane.remove( provisioningPanel );
+ centerTabbedPane.remove( hotpSettingsPanel );
+ centerTabbedPane.remove( userInfoPanel );
+ centerTabbedPane.addTab( "User Info", null, userInfoPanel, null );
+ userInfoPanel.setFields( localUser, "not implemented" );
}
descriptionTextArea.setText( user.getDescription() );
@@ -519,47 +495,29 @@
public void saveAction( HauskeysUser hauskeysUser )
{
- HauskeysUserModifier modifier = hauskeysUser.modifier().setDescription( descriptionTextArea.getText() );
- modifier.setDisabled( disabledCheckBox.isSelected() );
- userInfoPanel.alterModifier( modifier );
-
- if ( ! userInfoPanel.isPasswordOk() )
+ hauskeysUser.setDescription( descriptionTextArea.getText() );
+ hauskeysUser.setDisabled( disabledCheckBox.isSelected() );
+ userInfoPanel.alterModifier( hauskeysUser );
+
+ if ( !userInfoPanel.isPasswordOk() )
{
JOptionPane.showMessageDialog( this, "Passwords are not equal or are invalid. Save aborted!" );
return;
}
-
- hotpSettingsPanel.alterModifier( modifier );
- provisioningPanel.alterModifier( modifier );
- if ( modifier.isUpdateNeeded() )
- {
- try
- {
- user = modifier.modify();
- }
- catch ( DataAccessException e )
- {
- JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to modify user:\n" + e.getMessage(), 79 ),
- "User modification failure!", JOptionPane.ERROR_MESSAGE );
- return;
- }
- node.setUserObject( user );
- }
+ hotpSettingsPanel.alterUser( hauskeysUser );
+ provisioningPanel.alterModifier( hauskeysUser );
+
- if ( !user.getId().equals( userNorthPanel.getId() ) )
+ hauskeysUser.setId( userNorthPanel.getId() );
+ ( ( DefaultTreeModel ) tree.getModel() ).valueForPathChanged( new TreePath( node.getPath() ), user );
+ try
{
- try
- {
- user = hauskeysUser.modifier().rename( userNorthPanel.getId() );
- ( ( DefaultTreeModel ) tree.getModel() ).valueForPathChanged( new TreePath( node.getPath() ), user );
- }
- catch ( DataAccessException e )
- {
- JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to rename user:\n" + e.getMessage(), 79 ),
- "User rename failure!", JOptionPane.ERROR_MESSAGE );
- return;
- }
+ hauskeysUser.getStateManager().commit();
+ } catch ( NamingException e )
+ {
+ JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to modify user:\n" + e.getMessage(), 79 ),
+ "User modification failure!", JOptionPane.ERROR_MESSAGE );
}
node.setUserObject( user );
@@ -569,46 +527,31 @@
public void saveAction( LocalUser localUser )
{
- LocalUserModifier modifier = localUser.modifier().setDescription( descriptionTextArea.getText() );
- modifier.setDisabled( disabledCheckBox.isSelected() );
- userInfoPanel.alterModifier( modifier );
-
- if ( ! userInfoPanel.isPasswordOk() )
+ localUser.setDescription( descriptionTextArea.getText() );
+ localUser.setDisabled( disabledCheckBox.isSelected() );
+ userInfoPanel.alterModifier( localUser );
+
+ if ( !userInfoPanel.isPasswordOk() )
{
JOptionPane.showMessageDialog( this, "Passwords are not equal or are invalid. Save aborted!" );
return;
}
-
- if ( modifier.isUpdateNeeded() )
+
+
+ localUser.setId( userNorthPanel.getId() );
+ ( ( DefaultTreeModel ) tree.getModel() ).valueForPathChanged( new TreePath( node.getPath() ), user );
+
+ try
{
- try
- {
- user = modifier.modify();
- }
- catch ( DataAccessException e )
- {
- JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to modify user:\n" + e.getMessage(), 79 ),
- "User modification failure!", JOptionPane.ERROR_MESSAGE );
- return;
- }
- node.setUserObject( user );
+ localUser.getStateManager().commit();
}
-
- if ( !user.getId().equals( userNorthPanel.getId() ) )
+ catch ( NamingException e )
{
- try
- {
- user = localUser.modifier().rename( userNorthPanel.getId() );
- ( ( DefaultTreeModel ) tree.getModel() ).valueForPathChanged( new TreePath( node.getPath() ), user );
- }
- catch ( DataAccessException e )
- {
- JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to rename user:\n" + e.getMessage(), 79 ),
- "User rename failure!", JOptionPane.ERROR_MESSAGE );
- return;
- }
+ JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to modify user:\n" + e.getMessage(), 79 ),
+ "User modification failure!", JOptionPane.ERROR_MESSAGE );
+ return;
}
-
+ node.setUserObject( user );
node.setUserObject( user );
setUserFields();
}
@@ -616,39 +559,23 @@
public void saveAction( ExternalUser externalUser )
{
- ExternalUserModifier modifier = externalUser.modifier().setDescription( descriptionTextArea.getText() );
- modifier.setDisabled( disabledCheckBox.isSelected() );
- externalLinkPanel.alterModifier( modifier );
- if ( modifier.isUpdateNeeded() )
+ externalUser.setDescription( descriptionTextArea.getText() );
+ externalUser.setDisabled( disabledCheckBox.isSelected() );
+ externalLinkPanel.alterModifier( externalUser );
+
+ externalUser.setId( userNorthPanel.getId() );
+ ( ( DefaultTreeModel ) tree.getModel() ).valueForPathChanged( new TreePath( node.getPath() ), user );
+
+ try
{
- try
- {
- user = modifier.modify();
- }
- catch ( DataAccessException e )
- {
- JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to modify user:\n" + e.getMessage(), 79 ),
- "User modification failure!", JOptionPane.ERROR_MESSAGE );
- return;
- }
- node.setUserObject( user );
+ externalUser.getStateManager().commit();
}
-
- if ( !user.getId().equals( userNorthPanel.getId() ) )
+ catch ( NamingException e )
{
- try
- {
- user = externalUser.modifier().rename( userNorthPanel.getId() );
- ( ( DefaultTreeModel ) tree.getModel() ).valueForPathChanged( new TreePath( node.getPath() ), user );
- }
- catch ( DataAccessException e )
- {
- JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to rename user:\n" + e.getMessage(), 79 ),
- "User rename failure!", JOptionPane.ERROR_MESSAGE );
- return;
- }
+ JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to modify user:\n" + e.getMessage(), 79 ),
+ "User modification failure!", JOptionPane.ERROR_MESSAGE );
+ return;
}
-
node.setUserObject( user );
setUserFields();
}
@@ -659,16 +586,13 @@
if ( user instanceof ExternalUser )
{
saveAction( ( ExternalUser ) user );
- }
- else if ( user instanceof LocalUser )
+ } else if ( user instanceof LocalUser )
{
saveAction( ( LocalUser ) user );
- }
- else if ( user instanceof HauskeysUser )
+ } else if ( user instanceof HauskeysUser )
{
saveAction( ( HauskeysUser ) user );
- }
- else
+ } else
{
throw new IllegalStateException( "Unknown user type: " + user.getClass() );
}
@@ -677,14 +601,14 @@
public void statusChanged( StatusObject obj )
{
- if ( ! obj.isUpToDate() )
+ if ( !obj.isUpToDate() )
{
// userNorthPanel.setStatus( Color.RED, "Save needed!" );
return;
}
-
- if ( isUpToDate() && userNorthPanel.isUpToDate() && userInfoPanel.isUpToDate()
- && provisioningPanel.isUpToDate() && hotpSettingsPanel.isUpToDate() )
+
+ if ( isUpToDate() && userNorthPanel.isUpToDate() && userInfoPanel.isUpToDate()
+ && provisioningPanel.isUpToDate() && hotpSettingsPanel.isUpToDate() )
{
// userNorthPanel.setStatus( Color.GREEN, "Up to date!" );
}
@@ -728,9 +652,9 @@
/**
- * This method initializes jCheckBox
- *
- * @return javax.swing.JCheckBox
+ * This method initializes jCheckBox
+ *
+ * @return javax.swing.JCheckBox
*/
private JCheckBox getJCheckBox()
{
Modified: directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/safehaus/triplesec/verifier/hotp/GenerateHotp.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/safehaus/triplesec/verifier/hotp/GenerateHotp.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/safehaus/triplesec/verifier/hotp/GenerateHotp.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/safehaus/triplesec/verifier/hotp/GenerateHotp.java Thu Aug 9 16:40:15 2007
@@ -42,8 +42,8 @@
import org.apache.directory.server.core.configuration.Configuration;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.server.protocol.shared.store.Krb5KdcEntryFilter;
-import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
+//import org.apache.directory.server.protocol.shared.store.Krb5KdcEntryFilter;
+//import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
import org.apache.directory.server.schema.bootstrap.SystemSchema;
import org.apache.directory.server.schema.bootstrap.CosineSchema;
import org.apache.directory.server.schema.bootstrap.CoreSchema;
@@ -142,10 +142,11 @@
ServerProfileStore store = new DefaultServerProfileStore( userContext );
store.init();
- List filters = Collections.singletonList( new Krb5KdcEntryFilter() );
- LdifFileLoader ldifLoader = new LdifFileLoader( userContext, new File( "safehaus.ldif" ), filters,
- GenerateHotp.class.getClassLoader() );
- ldifLoader.execute();
+ //TODO find Krb5KdcEntryFilter and uncomment this code.
+// List filters = Collections.singletonList( new Krb5KdcEntryFilter() );
+// LdifFileLoader ldifLoader = new LdifFileLoader( userContext, new File( "safehaus.ldif" ), filters,
+// GenerateHotp.class.getClassLoader() );
+// ldifLoader.execute();
if ( args.length > 0 )
{
Modified: directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/safehaus/triplesec/verifier/hotp/HotpSamVerifierITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/safehaus/triplesec/verifier/hotp/HotpSamVerifierITest.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/safehaus/triplesec/verifier/hotp/HotpSamVerifierITest.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/verifier/src/test/java/org/safehaus/triplesec/verifier/hotp/HotpSamVerifierITest.java Thu Aug 9 16:40:15 2007
@@ -30,18 +30,19 @@
import javax.naming.directory.InitialDirContext;
import javax.naming.directory.Attributes;
import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.BasicAttribute;
import javax.security.auth.kerberos.KerberosKey;
import javax.security.auth.kerberos.KerberosPrincipal;
import junit.framework.TestCase;
import org.apache.commons.io.FileUtils;
-import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionEngine;
-import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionEngineFactory;
import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
+import org.apache.directory.server.kerberos.shared.crypto.encryption.CipherTextHandler;
+import org.apache.directory.server.kerberos.shared.crypto.encryption.KeyUsage;
import org.apache.directory.server.kerberos.shared.exceptions.KerberosException;
import org.apache.directory.server.kerberos.shared.io.encoder.EncryptedDataEncoder;
-import org.apache.directory.server.kerberos.shared.io.encoder.EncryptedTimestampEncoder;
import org.apache.directory.server.kerberos.shared.messages.value.EncryptedData;
import org.apache.directory.server.kerberos.shared.messages.value.EncryptedTimeStamp;
import org.apache.directory.server.kerberos.shared.messages.value.EncryptedTimeStampModifier;
@@ -55,7 +56,7 @@
import org.apache.directory.server.core.configuration.MutablePartitionConfiguration;
import org.apache.directory.server.core.configuration.MutableStartupConfiguration;
import org.apache.directory.server.core.configuration.ShutdownConfiguration;
-import org.apache.directory.server.protocol.shared.store.Krb5KdcEntryFilter;
+//import org.apache.directory.server.protocol.shared.store.Krb5KdcEntryFilter;
import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
import org.apache.directory.server.schema.bootstrap.SystemSchema;
import org.apache.directory.server.schema.bootstrap.ApacheSchema;
@@ -161,18 +162,22 @@
}
catch ( NamingException e )
{
- Attributes users = new BasicAttributes( "objectClass", "top", true );
- users.get( "objectClass" ).add( "organizationalUnit" );
- attrs.put( "ou", "users" );
- userContext = userContext.createSubcontext( "ou=users", attrs );
+ Attributes users = new AttributesImpl( );
+ Attribute ocAttr = new AttributeImpl( "objectClass" );
+ ocAttr.add( "top" );
+ ocAttr.add( "organizationalUnit" );
+ users.put(ocAttr);
+// users.get( "objectClass" ).add( "organizationalUnit" );
+ users.put( "ou", "users" );
+ userContext = userContext.createSubcontext( "ou=users", users );
}
store = new DefaultServerProfileStore( userContext );
store.init();
-
- List filters = Collections.singletonList( new Krb5KdcEntryFilter() );
- LdifFileLoader ldifLoader = new LdifFileLoader( userContext, new File( "safehaus.ldif" ), filters, getClass().getClassLoader() );
- ldifLoader.execute();
+//TODO find what happened to Krb5KdcEntryFilter and uncomment this code
+// List filters = Collections.singletonList( new Krb5KdcEntryFilter() );
+// LdifFileLoader ldifLoader = new LdifFileLoader( userContext, new File( "safehaus.ldif" ), filters, getClass().getClassLoader() );
+// ldifLoader.execute();
}
@@ -216,13 +221,10 @@
modifier.setKerberosTime( time );
EncryptedTimeStamp timeStamp = modifier.getEncryptedTimestamp();
- // Encode the Timestamp into ASN.1
- EncryptedTimestampEncoder encoder = new EncryptedTimestampEncoder();
- byte[] timeBytes = encoder.encode( timeStamp );
-
// Encrypt the Timestamp
- EncryptionEngine engine = EncryptionEngineFactory.getEncryptionEngineFor( key );
- EncryptedData encryptedData = engine.getEncryptedData( key, timeBytes );
+ CipherTextHandler engine = new CipherTextHandler();
+ //TODO no idea about which KeyUsage is desired
+ EncryptedData encryptedData = engine.seal( key, timeStamp, KeyUsage.NUMBER1 );
// Encode the EncryptedData
sad = EncryptedDataEncoder.encode( encryptedData );
@@ -239,7 +241,7 @@
return sad;
}
-
+
/**
* Tests that accounts lock out and ones that are locked from start do not
* succeed.
Modified: directory/sandbox/djencks/triplesec-jacc2/webapp-config/src/main/java/org/safehaus/triplesec/configui/util/TriplesecConfigBuilder.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/webapp-config/src/main/java/org/safehaus/triplesec/configui/util/TriplesecConfigBuilder.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/webapp-config/src/main/java/org/safehaus/triplesec/configui/util/TriplesecConfigBuilder.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/webapp-config/src/main/java/org/safehaus/triplesec/configui/util/TriplesecConfigBuilder.java Thu Aug 9 16:40:15 2007
@@ -47,7 +47,7 @@
import org.apache.directory.server.core.subtree.SubentryService;
import org.apache.directory.server.ldap.support.extended.GracefulShutdownHandler;
import org.apache.directory.server.ldap.support.extended.LaunchDiagnosticUiHandler;
-import org.apache.directory.server.protocol.shared.store.Krb5KdcEntryFilter;
+//import org.apache.directory.server.protocol.shared.store.Krb5KdcEntryFilter;
import org.apache.directory.server.schema.bootstrap.CorbaSchema;
import org.apache.directory.server.schema.bootstrap.JavaSchema;
import org.apache.directory.server.schema.bootstrap.SystemSchema;
@@ -90,9 +90,9 @@
baseDn = baseDn.toLowerCase();
// NTP causes exceptions everytime and has little utility - disabling it
- config.setEnableNtp( false );
+// config.setEnableNtp( false );
- config.setLdapPort( ( int ) settings.getLdapPort() ); // @todo make getLdapPort() return an int
+// config.setLdapPort( ( int ) settings.getLdapPort() ); // @todo make getLdapPort() return an int
config.setPresentationBaseUrl( settings.getPresentationBaseUrl() );
if ( realm.toUpperCase().equals( "EXAMPLE.COM" ) )
@@ -111,12 +111,14 @@
partition.setSuffix( baseDn );
if ( realm.indexOf( '.' ) == -1 )
{
- partition.setName( realm.toLowerCase() );
+// partition.setName( realm.toLowerCase() );
+ partition.setId( realm.toLowerCase() );
}
else
{
String[] comps = realm.split( "\\." );
- partition.setName( comps[0].toLowerCase() );
+// partition.setName( comps[0].toLowerCase() );
+ partition.setId( comps[0].toLowerCase() );
}
// setup indices
@@ -136,7 +138,8 @@
Attributes contextEntry = new BasicAttributes( "objectClass", "top", true );
contextEntry.get( "objectClass" ).add( "domain" );
contextEntry.get( "objectClass" ).add( "extensibleObject" );
- contextEntry.put( "dc", partition.getName() );
+// contextEntry.put( "dc", partition.getName() );
+ contextEntry.put( "dc", partition.getId() );
contextEntry.put( "administrativeRole", "accessControlSpecificArea" );
contextEntry.get( "administrativeRole" ).add( "collectiveAttributeSpecificArea" );
partition.setContextEntry( contextEntry );
@@ -191,14 +194,14 @@
if ( settings.isEnableLdaps() )
{
File certFile = new File( settings.getLdapCertFilePath() );
- config.setEnableLdaps( true );
- config.setLdapsPort( settings.getLdapsPort() );
- config.setLdapsCertificateFile( certFile );
- config.setLdapsCertificatePassword( settings.getLdapCertPassword() );
+// config.setEnableLdaps( true );
+// config.setLdapsPort( settings.getLdapsPort() );
+// config.setLdapsCertificateFile( certFile );
+// config.setLdapsCertificatePassword( settings.getLdapCertPassword() );
}
else
{
- config.setEnableLdaps( false );
+// config.setEnableLdaps( false );
}
return config;
@@ -208,17 +211,17 @@
public MutableTriplesecStartupConfiguration getDefault() throws NamingException
{
MutableTriplesecStartupConfiguration config = new MutableTriplesecStartupConfiguration();
- config.setLdapPort( 10389 );
+// config.setLdapPort( 10389 );
config.setAccessControlEnabled( true );
config.setShutdownHookEnabled( true );
config.setAllowAnonymousAccess( false );
- config.setEnableChangePassword( true );
- config.setEnableKerberos( true );
+// config.setEnableChangePassword( true );
+// config.setEnableKerberos( true );
config.setEnableNetworking( true );
- config.setEnableLdaps( false );
- config.setEnableNtp( true );
+// config.setEnableLdaps( false );
+// config.setEnableNtp( true );
config.setExitVmOnShutdown( true );
- config.setLdifDirectory( new File( "conf" ) );
+// config.setLdifDirectory( new File( "conf" ) );
config.setWorkingDirectory( new File( "var/partitions" ) );
try
@@ -232,67 +235,67 @@
}
List filters = new ArrayList();
- filters.add( new Krb5KdcEntryFilter() );
- config.setLdifFilters( filters );
+// filters.add( new Krb5KdcEntryFilter() );
+// config.setLdifFilters( filters );
List interceptors = new ArrayList();
MutableInterceptorConfiguration interceptorConfiguration = new MutableInterceptorConfiguration();
- interceptorConfiguration.setInterceptor( new NormalizationService() );
+ interceptorConfiguration.setInterceptorClassName( NormalizationService.class.getName() );
interceptorConfiguration.setName( "normalizationService" );
interceptors.add( interceptorConfiguration );
interceptorConfiguration = new MutableInterceptorConfiguration();
- interceptorConfiguration.setInterceptor( new AuthenticationService() );
+ interceptorConfiguration.setInterceptorClassName( AuthenticationService.class.getName() );
interceptorConfiguration.setName( "authenticationService" );
interceptors.add( interceptorConfiguration );
interceptorConfiguration = new MutableInterceptorConfiguration();
- interceptorConfiguration.setInterceptor( new ReferralService() );
+ interceptorConfiguration.setInterceptorClassName( ReferralService.class.getName() );
interceptorConfiguration.setName( "referralService" );
interceptors.add( interceptorConfiguration );
interceptorConfiguration = new MutableInterceptorConfiguration();
- interceptorConfiguration.setInterceptor( new AuthorizationService() );
+ interceptorConfiguration.setInterceptorClassName( AuthorizationService.class.getName() );
interceptorConfiguration.setName( "authorizationService" );
interceptors.add( interceptorConfiguration );
interceptorConfiguration = new MutableInterceptorConfiguration();
- interceptorConfiguration.setInterceptor( new DefaultAuthorizationService() );
+ interceptorConfiguration.setInterceptorClassName( DefaultAuthorizationService.class.getName() );
interceptorConfiguration.setName( "defaultAuthorizationService" );
interceptors.add( interceptorConfiguration );
interceptorConfiguration = new MutableInterceptorConfiguration();
- interceptorConfiguration.setInterceptor( new ExceptionService() );
+ interceptorConfiguration.setInterceptorClassName( ExceptionService.class.getName() );
interceptorConfiguration.setName( "exceptionService" );
interceptors.add( interceptorConfiguration );
interceptorConfiguration = new MutableInterceptorConfiguration();
- interceptorConfiguration.setInterceptor( new SchemaService() );
+ interceptorConfiguration.setInterceptorClassName( SchemaService.class.getName() );
interceptorConfiguration.setName( "schemaService" );
interceptors.add( interceptorConfiguration );
interceptorConfiguration = new MutableInterceptorConfiguration();
- interceptorConfiguration.setInterceptor( new SubentryService() );
+ interceptorConfiguration.setInterceptorClassName( SubentryService.class.getName() );
interceptorConfiguration.setName( "subentryService" );
interceptors.add( interceptorConfiguration );
interceptorConfiguration = new MutableInterceptorConfiguration();
- interceptorConfiguration.setInterceptor( new OperationalAttributeService() );
+ interceptorConfiguration.setInterceptorClassName( OperationalAttributeService.class.getName() );
interceptorConfiguration.setName( "operationalAttributeService" );
interceptors.add( interceptorConfiguration );
interceptorConfiguration = new MutableInterceptorConfiguration();
- interceptorConfiguration.setInterceptor( new CollectiveAttributeService() );
+ interceptorConfiguration.setInterceptorClassName( CollectiveAttributeService.class.getName() );
interceptorConfiguration.setName( "collectiveAttributeService" );
interceptors.add( interceptorConfiguration );
interceptorConfiguration = new MutableInterceptorConfiguration();
- interceptorConfiguration.setInterceptor( new EventService() );
+ interceptorConfiguration.setInterceptorClassName( EventService.class.getName() );
interceptorConfiguration.setName( "eventService" );
interceptors.add( interceptorConfiguration );
interceptorConfiguration = new MutableInterceptorConfiguration();
- interceptorConfiguration.setInterceptor( new PolicyProtectionInterceptor() );
+ interceptorConfiguration.setInterceptorClassName( PolicyProtectionInterceptor.class.getName() );
interceptorConfiguration.setName( "policyProtectionInterceptor" );
interceptors.add( interceptorConfiguration );
@@ -301,7 +304,7 @@
List extendedHandlers = new ArrayList();
extendedHandlers.add( new GracefulShutdownHandler() );
extendedHandlers.add( new LaunchDiagnosticUiHandler() );
- config.setExtendedOperationHandlers( extendedHandlers );
+// config.setExtendedOperationHandlers( extendedHandlers );
config.getSmsConfiguration().setSmsAccountName( "foo" );
config.getSmsConfiguration().setSmsUsername( "bar" );
@@ -315,7 +318,8 @@
Set partitions = new HashSet( config.getPartitionConfigurations() );
MutablePartitionConfiguration partitionConfiguration = new MutablePartitionConfiguration();
- partitionConfiguration.setName( "example" );
+// partitionConfiguration.setName( "example" );
+ partitionConfiguration.setId( "example" );
partitionConfiguration.setSuffix( "dc=example,dc=com" );
Set indices = new HashSet();
indices.add( "objectClass" );
Modified: directory/sandbox/djencks/triplesec-jacc2/webapp-config/src/test/java/org/safehaus/triplesec/configui/util/TriplesecConfigBuilderTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/webapp-config/src/test/java/org/safehaus/triplesec/configui/util/TriplesecConfigBuilderTest.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/webapp-config/src/test/java/org/safehaus/triplesec/configui/util/TriplesecConfigBuilderTest.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/webapp-config/src/test/java/org/safehaus/triplesec/configui/util/TriplesecConfigBuilderTest.java Thu Aug 9 16:40:15 2007
@@ -49,11 +49,12 @@
settings.setPrimaryRealmName( "APACHE.ORG" );
MutableTriplesecStartupConfiguration config = builder.build( settings );
- assertEquals( 1389, config.getLdapPort() );
+// assertEquals( 1389, config.getLdapPort() );
assertEquals( 1, config.getPartitionConfigurations().size() );
MutablePartitionConfiguration partition = ( MutablePartitionConfiguration )
config.getPartitionConfigurations().iterator().next();
- assertEquals( "apache", partition.getName() );
+// assertEquals( "apache", partition.getName() );
+ assertEquals( "apache", partition.getId() );
assertEquals( "dc=apache,dc=org", partition.getSuffix() );
Attributes attrs = partition.getContextEntry();
assertTrue( attrs.get( "dc" ).contains( "apache" ) );
Modified: directory/sandbox/djencks/triplesec-jacc2/webapp-registration/src/main/java/org/safehaus/triplesec/registration/view/TriplesecRegistrationApplication.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/webapp-registration/src/main/java/org/safehaus/triplesec/registration/view/TriplesecRegistrationApplication.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/webapp-registration/src/main/java/org/safehaus/triplesec/registration/view/TriplesecRegistrationApplication.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/webapp-registration/src/main/java/org/safehaus/triplesec/registration/view/TriplesecRegistrationApplication.java Thu Aug 9 16:40:15 2007
@@ -24,14 +24,11 @@
import javax.naming.Context;
-import wicket.protocol.http.WebApplication;
-
import org.safehaus.triplesec.admin.TriplesecAdmin;
-import org.safehaus.triplesec.admin.dao.DaoFactory;
-import org.safehaus.triplesec.admin.dao.ldap.LdapDaoFactory;
import org.safehaus.triplesec.configuration.SmsConfiguration;
import org.safehaus.triplesec.configuration.SmtpConfiguration;
import org.safehaus.triplesec.registration.view.pages.WizardPage;
+import wicket.protocol.http.WebApplication;
public class TriplesecRegistrationApplication extends WebApplication
@@ -104,7 +101,7 @@
// -------------------------------------------------------------------
Properties env = new Properties();
- env.put( DaoFactory.IMPLEMENTATION_CLASS, LdapDaoFactory.class.getName() );
+// env.put( DaoFactory.IMPLEMENTATION_CLASS, LdapDaoFactory.class.getName() );
env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
StringBuffer buf = new StringBuffer();
Modified: directory/sandbox/djencks/triplesec-jacc2/webapp-registration/src/main/java/org/safehaus/triplesec/registration/view/panels/WizardPanelFinish.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/webapp-registration/src/main/java/org/safehaus/triplesec/registration/view/panels/WizardPanelFinish.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/webapp-registration/src/main/java/org/safehaus/triplesec/registration/view/panels/WizardPanelFinish.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/webapp-registration/src/main/java/org/safehaus/triplesec/registration/view/panels/WizardPanelFinish.java Thu Aug 9 16:40:15 2007
@@ -19,7 +19,7 @@
*/
package org.safehaus.triplesec.registration.view.panels;
-
+
import java.io.IOException;
import java.util.Date;
import java.util.Properties;
@@ -29,7 +29,9 @@
import javax.mail.Session;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
+import javax.naming.NamingException;
+import com.sun.mail.smtp.SMTPTransport;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.NameValuePair;
@@ -38,26 +40,19 @@
import org.apache.commons.lang.math.RandomUtils;
import org.apache.directory.shared.ldap.util.StringTools;
import org.safehaus.sms.Carrier;
-import org.safehaus.triplesec.admin.Application;
import org.safehaus.triplesec.admin.DataAccessException;
import org.safehaus.triplesec.admin.HauskeysUser;
-import org.safehaus.triplesec.admin.HauskeysUserModifier;
import org.safehaus.triplesec.admin.TriplesecAdmin;
-import org.safehaus.triplesec.admin.Profile;
-import org.safehaus.triplesec.admin.persistence.PCException;
import org.safehaus.triplesec.configuration.SmsConfiguration;
import org.safehaus.triplesec.configuration.SmtpConfiguration;
import org.safehaus.triplesec.registration.model.RegistrationInfo;
import org.safehaus.triplesec.registration.view.TriplesecRegistrationApplication;
-
-import com.sun.mail.smtp.SMTPTransport;
-
-import wicket.model.IModel;
-import wicket.model.Model;
+import wicket.Component;
+import wicket.markup.html.basic.Label;
import wicket.markup.html.form.Button;
import wicket.markup.html.link.ExternalLink;
-import wicket.markup.html.basic.Label;
-import wicket.Component;
+import wicket.model.IModel;
+import wicket.model.Model;
/**
@@ -123,7 +118,7 @@
// create the user entry
// -----------------------------------------------------------
- String activationKey = null;
+ String activationKey;
try
{
@@ -138,25 +133,37 @@
return;
}
- HauskeysUserModifier modifier = admin
- .newHauskeysUser( info.getUsername(), info.getFirstName(), info.getLastName(), info.getPassword() )
- .setEmail( info.getEmail() ).setLabel( info.getMidletName() )
- .setMidletName( info.getMidletName() ).setMobile( info.getMobile() )
- .setMobileCarrier( info.getMobileCarrier() ).setNotifyBy( info.getDeploymentMechanism() )
- .setPassword( info.getPassword() ).setRealm( app.getRealm() ).setTokenPin( info.getTokenPin() )
- .setActivationKey( activationKey ).setSecret( StringTools.utf8ToString( getRandomSecret() ) )
- .setMovingFactor( getRandomFactor() ).setAddress1( info.getAddress1() )
- .setAddress2( info.getAddress2() ).setCity( info.getCity() ).setCountry( info.getCountry() )
- .setStateProvRegion( info.getStateProvRegion() ).setZipPostalCode( info.getZipPostalCode() );
-
- HauskeysUser user;
+ HauskeysUser user = new HauskeysUser( );
+ user.setId(info.getUsername());
+ user.setFirstName( info.getFirstName());
+ user.setLastName( info.getLastName());
+ user.setPassword( info.getPassword() );
+ user.setEmail( info.getEmail() );
+ user.setLabel( info.getMidletName() );
+ user.setMidletName( info.getMidletName() );
+ user.setMobile( info.getMobile() );
+ user.setMobileCarrier( info.getMobileCarrier() );
+ user.setNotifyBy( info.getDeploymentMechanism() );
+ user.setPassword( info.getPassword() );
+ user.setRealm( app.getRealm() );
+ user.setTokenPin( info.getTokenPin() );
+ user.setActivationKey( activationKey );
+ user.setSecret( StringTools.utf8ToString( getRandomSecret() ) );
+ user.setMovingFactor( getRandomFactor() );
+ user.setAddress1( info.getAddress1() );
+ user.setAddress2( info.getAddress2() );
+ user.setCity( info.getCity() );
+ user.setCountry( info.getCountry() );
+ user.setStateProvRegion( info.getStateProvRegion() );
+ user.setZipPostalCode( info.getZipPostalCode() );
+
+ user.getStateManager().getEntityManager().persist( user, null);
try
{
- user = modifier.add();
- }
- catch ( DataAccessException e )
+ user.getStateManager().commit();
+ } catch ( NamingException e )
{
- message = "Registration for user " + info.getUsername()
+ message = "Registration for user " + info.getUsername()
+ " failed. Notifications will NOT be delivered.";
hideButtons();
error( "Registration failed!" );
@@ -167,6 +174,7 @@
// Add a profile for the user to the demo app if it exists
// -----------------------------------------------------------
+/*
Application demoApp = null;
try
{
@@ -193,6 +201,7 @@
return;
}
}
+*/
// -----------------------------------------------------------
// Send notifications
Modified: directory/sandbox/djencks/triplesec-jacc2/webapp-wicket-admin/src/main/java/org/safehaus/triplesec/adminui/services/ConnectionManager.java
URL: http://svn.apache.org/viewvc/directory/sandbox/djencks/triplesec-jacc2/webapp-wicket-admin/src/main/java/org/safehaus/triplesec/adminui/services/ConnectionManager.java?view=diff&rev=564425&r1=564424&r2=564425
==============================================================================
--- directory/sandbox/djencks/triplesec-jacc2/webapp-wicket-admin/src/main/java/org/safehaus/triplesec/adminui/services/ConnectionManager.java (original)
+++ directory/sandbox/djencks/triplesec-jacc2/webapp-wicket-admin/src/main/java/org/safehaus/triplesec/adminui/services/ConnectionManager.java Thu Aug 9 16:40:15 2007
@@ -19,17 +19,16 @@
*/
package org.safehaus.triplesec.adminui.services;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.util.Observable;
+import java.util.Properties;
+
+import javax.naming.Context;
+
import org.safehaus.triplesec.admin.TriplesecAdmin;
-import org.safehaus.triplesec.admin.dao.DaoFactory;
-import org.safehaus.triplesec.admin.dao.ldap.LdapDaoFactory;
import org.safehaus.triplesec.adminui.models.ConnectionInfo;
import org.safehaus.triplesec.configuration.TriplesecStartupConfiguration;
-
-import javax.naming.Context;
-import java.util.Observable;
-import java.util.Properties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Manages a connection to a Triplesec server.
@@ -47,7 +46,7 @@
public boolean connect( ConnectionInfo connectionInfo )
{
Properties env = new Properties();
- env.put( DaoFactory.IMPLEMENTATION_CLASS, LdapDaoFactory.class.getName() );
+// env.put( DaoFactory.IMPLEMENTATION_CLASS, LdapDaoFactory.class.getName() );
env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
StringBuffer buf = new StringBuffer();
@@ -117,10 +116,11 @@
Properties props = new Properties();
props.putAll( env );
props.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
- props.put( DaoFactory.IMPLEMENTATION_CLASS, LdapDaoFactory.class.getName() );
+// props.put( DaoFactory.IMPLEMENTATION_CLASS, LdapDaoFactory.class.getName() );
StringBuffer buf = new StringBuffer();
- buf.append( "ldap://localhost:" ).append( config.getLdapPort() );
- buf.append( "/" ).append( props.getProperty( Context.PROVIDER_URL ) );
+ //TODO hook this up again
+// buf.append( "ldap://localhost:" ).append( config.getLdapPort() );
+// buf.append( "/" ).append( props.getProperty( Context.PROVIDER_URL ) );
props.put( Context.PROVIDER_URL, buf.toString() );
props.remove( "java.naming.factory.object" );
props.remove( "java.naming.factory.state" );