mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Updating with SSO
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@8167 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
BIN
build/lib/dist/smack.jar
vendored
BIN
build/lib/dist/smack.jar
vendored
Binary file not shown.
BIN
build/lib/dist/smackx-debug.jar
vendored
BIN
build/lib/dist/smackx-debug.jar
vendored
Binary file not shown.
BIN
build/lib/dist/smackx.jar
vendored
BIN
build/lib/dist/smackx.jar
vendored
Binary file not shown.
@ -11,7 +11,7 @@
|
|||||||
<excludeFolder url="file://$MODULE_DIR$/../../src/plugins" />
|
<excludeFolder url="file://$MODULE_DIR$/../../src/plugins" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../target" />
|
<excludeFolder url="file://$MODULE_DIR$/../../target" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="JDK 1.5.0" jdkType="JavaSDK" />
|
<orderEntry type="jdk" jdkName="1.6" jdkType="JavaSDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="module-library" exported="">
|
<orderEntry type="module-library" exported="">
|
||||||
<library>
|
<library>
|
||||||
|
|||||||
60
src/java/GSAPPIConfiguration.java
Normal file
60
src/java/GSAPPIConfiguration.java
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
package org.jivesoftware;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.security.*;
|
||||||
|
import javax.security.auth.*;
|
||||||
|
import javax.security.auth.login.*;
|
||||||
|
|
||||||
|
|
||||||
|
public class GSAPPIConfiguration extends Configuration {
|
||||||
|
|
||||||
|
Map<String,Vector<AppConfigurationEntry>> configs;
|
||||||
|
|
||||||
|
GSAPPIConfiguration() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
configs = new HashMap<String,Vector<AppConfigurationEntry>>();
|
||||||
|
|
||||||
|
//The structure of the options is not well documented in terms of
|
||||||
|
//data types. Since the file version of the Configuration object
|
||||||
|
//puts things in quotes, String is assumed. But boolean options
|
||||||
|
//do not have quotes, and my represent different types internally.
|
||||||
|
HashMap<String,String> c_options = new HashMap<String,String>();
|
||||||
|
c_options.put("doNotPrompt","true");
|
||||||
|
c_options.put("useTicketCache","true");
|
||||||
|
c_options.put("debug","true");
|
||||||
|
|
||||||
|
|
||||||
|
putAppConfigurationEntry("GetPrincipal","com.sun.security.auth.module.Krb5LoginModule",AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,c_options);
|
||||||
|
putAppConfigurationEntry("com.sun.security.jgss.initiate","com.sun.security.auth.module.Krb5LoginModule",AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,c_options);
|
||||||
|
putAppConfigurationEntry("com.sun.security.jgss.krb5.initiate","com.sun.security.auth.module.Krb5LoginModule",AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,c_options);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
|
||||||
|
AppConfigurationEntry[] a = new AppConfigurationEntry[1];
|
||||||
|
if(configs.containsKey(name)) {
|
||||||
|
Vector<AppConfigurationEntry> v = configs.get(name);
|
||||||
|
a = v.toArray(a);
|
||||||
|
return a;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean putAppConfigurationEntry(String name, String module, AppConfigurationEntry.LoginModuleControlFlag controlFlag, Map options) {
|
||||||
|
Vector<AppConfigurationEntry> v;
|
||||||
|
if(configs.containsKey(name)) {
|
||||||
|
v = configs.get(name);
|
||||||
|
} else {
|
||||||
|
v = new Vector<AppConfigurationEntry>();
|
||||||
|
configs.put(name,v);
|
||||||
|
}
|
||||||
|
|
||||||
|
return v.add(new AppConfigurationEntry(module,controlFlag,options));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void refresh() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -39,6 +39,7 @@ import org.jivesoftware.sparkimpl.plugin.layout.LayoutSettingsManager;
|
|||||||
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
||||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||||
|
|
||||||
|
import javax.security.auth.login.Configuration;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
@ -127,7 +128,7 @@ public final class LoginDialog {
|
|||||||
|
|
||||||
mainPanel.add(imagePanel,
|
mainPanel.add(imagePanel,
|
||||||
new GridBagConstraints(0, 0, 4, 1,
|
new GridBagConstraints(0, 0, 4, 1,
|
||||||
1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
|
1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
|
||||||
new Insets(0, 0, 0, 0), 0, 0));
|
new Insets(0, 0, 0, 0), 0, 0));
|
||||||
|
|
||||||
final String showPoweredBy = Default.getString(Default.SHOW_POWERED_BY);
|
final String showPoweredBy = Default.getString(Default.SHOW_POWERED_BY);
|
||||||
@ -144,7 +145,7 @@ public final class LoginDialog {
|
|||||||
loginPanel.setOpaque(false);
|
loginPanel.setOpaque(false);
|
||||||
mainPanel.add(loginPanel,
|
mainPanel.add(loginPanel,
|
||||||
new GridBagConstraints(0, 2, 2, 1,
|
new GridBagConstraints(0, 2, 2, 1,
|
||||||
1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
|
1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
|
||||||
new Insets(0, 0, 0, 0), 0, 0));
|
new Insets(0, 0, 0, 0), 0, 0));
|
||||||
|
|
||||||
loginDialog.setContentPane(mainPanel);
|
loginDialog.setContentPane(mainPanel);
|
||||||
@ -187,6 +188,7 @@ public final class LoginDialog {
|
|||||||
|
|
||||||
private final JCheckBox savePasswordBox = new JCheckBox();
|
private final JCheckBox savePasswordBox = new JCheckBox();
|
||||||
private final JCheckBox autoLoginBox = new JCheckBox();
|
private final JCheckBox autoLoginBox = new JCheckBox();
|
||||||
|
private final JCheckBox useSSOBox = new JCheckBox();
|
||||||
private final RolloverButton loginButton = new RolloverButton();
|
private final RolloverButton loginButton = new RolloverButton();
|
||||||
private final RolloverButton advancedButton = new RolloverButton();
|
private final RolloverButton advancedButton = new RolloverButton();
|
||||||
private final RolloverButton quitButton = new RolloverButton();
|
private final RolloverButton quitButton = new RolloverButton();
|
||||||
@ -208,6 +210,7 @@ public final class LoginDialog {
|
|||||||
//setBorder(BorderFactory.createTitledBorder("Sign In Now"));
|
//setBorder(BorderFactory.createTitledBorder("Sign In Now"));
|
||||||
ResourceUtils.resButton(savePasswordBox, Res.getString("checkbox.save.password"));
|
ResourceUtils.resButton(savePasswordBox, Res.getString("checkbox.save.password"));
|
||||||
ResourceUtils.resButton(autoLoginBox, Res.getString("checkbox.auto.login"));
|
ResourceUtils.resButton(autoLoginBox, Res.getString("checkbox.auto.login"));
|
||||||
|
ResourceUtils.resButton(useSSOBox, "&Use Single Sign-On");
|
||||||
ResourceUtils.resLabel(serverLabel, serverField, Res.getString("label.server"));
|
ResourceUtils.resLabel(serverLabel, serverField, Res.getString("label.server"));
|
||||||
ResourceUtils.resButton(createAccountButton, Res.getString("label.accounts"));
|
ResourceUtils.resButton(createAccountButton, Res.getString("label.accounts"));
|
||||||
|
|
||||||
@ -218,70 +221,75 @@ public final class LoginDialog {
|
|||||||
|
|
||||||
add(usernameLabel,
|
add(usernameLabel,
|
||||||
new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
|
new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
|
||||||
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 5, 5), 0, 0));
|
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 2, 2, 2), 0, 0));
|
||||||
add(usernameField,
|
add(usernameField,
|
||||||
new GridBagConstraints(1, 1, 2, 1,
|
new GridBagConstraints(1, 1, 2, 1,
|
||||||
1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
|
1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
|
||||||
new Insets(15, 5, 5, 5), 0, 0));
|
new Insets(15, 2, 2, 2), 0, 0));
|
||||||
|
|
||||||
add(passwordField,
|
add(passwordField,
|
||||||
new GridBagConstraints(1, 2, 2, 1,
|
new GridBagConstraints(1, 2, 2, 1,
|
||||||
1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
|
1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
|
||||||
new Insets(0, 5, 5, 5), 0, 0));
|
new Insets(2, 2, 2, 5), 0, 0));
|
||||||
add(passwordLabel,
|
add(passwordLabel,
|
||||||
new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
|
new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
|
||||||
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 5, 0));
|
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 5, 0));
|
||||||
|
|
||||||
// Add Server Field Properties
|
// Add Server Field Properties
|
||||||
add(serverField,
|
add(serverField,
|
||||||
new GridBagConstraints(1, 4, 2, 1,
|
new GridBagConstraints(1, 4, 2, 1,
|
||||||
1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
|
1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
|
||||||
new Insets(0, 5, 5, 5), 0, 0));
|
new Insets(2, 2, 2, 2), 0, 0));
|
||||||
add(serverLabel,
|
add(serverLabel,
|
||||||
new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0,
|
new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0,
|
||||||
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 5, 0));
|
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 5, 0));
|
||||||
|
|
||||||
|
|
||||||
add(savePasswordBox,
|
add(savePasswordBox,
|
||||||
new GridBagConstraints(1, 5, 2, 1, 1.0, 0.0,
|
new GridBagConstraints(1, 5, 2, 1, 1.0, 0.0,
|
||||||
GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0));
|
GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));
|
||||||
add(autoLoginBox,
|
add(autoLoginBox,
|
||||||
new GridBagConstraints(1, 6, 2, 1, 1.0, 0.0,
|
new GridBagConstraints(1, 6, 2, 1, 1.0, 0.0,
|
||||||
GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0));
|
GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));
|
||||||
|
|
||||||
|
add(useSSOBox,
|
||||||
|
new GridBagConstraints(1, 7, 2, 1, 1.0, 0.0,
|
||||||
|
GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));
|
||||||
|
|
||||||
// Add button but disable the login button initially
|
// Add button but disable the login button initially
|
||||||
savePasswordBox.addActionListener(this);
|
savePasswordBox.addActionListener(this);
|
||||||
autoLoginBox.addActionListener(this);
|
autoLoginBox.addActionListener(this);
|
||||||
|
useSSOBox.setOpaque(false);
|
||||||
|
|
||||||
|
useSSOBox.addActionListener(this);
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
buttonPanel.add(quitButton,
|
|
||||||
new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0,
|
|
||||||
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 0), 0, 0));
|
|
||||||
*/
|
|
||||||
if (!"true".equals(Default.getString(Default.ACCOUNT_DISABLED))) {
|
if (!"true".equals(Default.getString(Default.ACCOUNT_DISABLED))) {
|
||||||
buttonPanel.add(createAccountButton,
|
buttonPanel.add(createAccountButton,
|
||||||
new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
|
new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
|
||||||
GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0));
|
GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));
|
||||||
}
|
}
|
||||||
buttonPanel.add(advancedButton,
|
buttonPanel.add(advancedButton,
|
||||||
new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
|
new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
|
||||||
GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0));
|
GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));
|
||||||
buttonPanel.add(loginButton,
|
buttonPanel.add(loginButton,
|
||||||
new GridBagConstraints(3, 0, 4, 1, 1.0, 0.0,
|
new GridBagConstraints(3, 0, 4, 1, 1.0, 0.0,
|
||||||
GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 0), 0, 0));
|
GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
|
||||||
|
|
||||||
cardPanel.add(buttonPanel, BUTTON_PANEL);
|
cardPanel.add(buttonPanel, BUTTON_PANEL);
|
||||||
|
|
||||||
cardPanel.setOpaque(false);
|
cardPanel.setOpaque(false);
|
||||||
buttonPanel.setOpaque(false);
|
buttonPanel.setOpaque(false);
|
||||||
|
|
||||||
progressBar.setHorizontalAlignment(JLabel.CENTER);
|
ImageIcon icon = new ImageIcon(getClass().getClassLoader().getResource("images/ajax-loader.gif"));
|
||||||
|
progressBar.setIcon(icon);
|
||||||
cardPanel.add(progressBar, PROGRESS_BAR);
|
cardPanel.add(progressBar, PROGRESS_BAR);
|
||||||
|
|
||||||
add(cardPanel,
|
|
||||||
new GridBagConstraints(0, 7, 4, 1,
|
|
||||||
1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
|
add(cardPanel, new GridBagConstraints(0, 8, 4, 1,
|
||||||
new Insets(5, 5, 5, 5), 0, 0));
|
1.0, 1.0, GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL,
|
||||||
|
new Insets(2, 2, 2, 2), 0, 0));
|
||||||
loginButton.setEnabled(false);
|
loginButton.setEnabled(false);
|
||||||
|
|
||||||
// Add KeyListener
|
// Add KeyListener
|
||||||
@ -303,7 +311,9 @@ public final class LoginDialog {
|
|||||||
|
|
||||||
// Set progress bar description
|
// Set progress bar description
|
||||||
progressBar.setText(Res.getString("message.autenticating"));
|
progressBar.setText(Res.getString("message.autenticating"));
|
||||||
//progressBar.setStringPainted(true);
|
progressBar.setVerticalTextPosition(JLabel.BOTTOM);
|
||||||
|
progressBar.setHorizontalTextPosition(JLabel.CENTER);
|
||||||
|
progressBar.setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
|
||||||
// Set Resources
|
// Set Resources
|
||||||
ResourceUtils.resLabel(usernameLabel, usernameField, Res.getString("label.username"));
|
ResourceUtils.resLabel(usernameLabel, usernameField, Res.getString("label.username"));
|
||||||
@ -422,6 +432,22 @@ public final class LoginDialog {
|
|||||||
else if (e.getSource() == loginButton) {
|
else if (e.getSource() == loginButton) {
|
||||||
validateLogin();
|
validateLogin();
|
||||||
}
|
}
|
||||||
|
else if (e.getSource() == useSSOBox) {
|
||||||
|
if (useSSOBox.isSelected()) {
|
||||||
|
usernameField.setVisible(false);
|
||||||
|
passwordField.setVisible(false);
|
||||||
|
savePasswordBox.setVisible(false);
|
||||||
|
usernameLabel.setVisible(false);
|
||||||
|
passwordLabel.setVisible(false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
usernameField.setVisible(true);
|
||||||
|
passwordField.setVisible(true);
|
||||||
|
savePasswordBox.setVisible(true);
|
||||||
|
usernameLabel.setVisible(true);
|
||||||
|
passwordLabel.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (e.getSource() == advancedButton) {
|
else if (e.getSource() == advancedButton) {
|
||||||
final LoginSettingDialog loginSettingsDialog = new LoginSettingDialog();
|
final LoginSettingDialog loginSettingsDialog = new LoginSettingDialog();
|
||||||
loginSettingsDialog.invoke(loginDialog);
|
loginSettingsDialog.invoke(loginDialog);
|
||||||
@ -577,6 +603,12 @@ public final class LoginDialog {
|
|||||||
*/
|
*/
|
||||||
private boolean login() {
|
private boolean login() {
|
||||||
final SessionManager sessionManager = SparkManager.getSessionManager();
|
final SessionManager sessionManager = SparkManager.getSessionManager();
|
||||||
|
if (useSSOBox.isSelected()) {
|
||||||
|
System.setProperty("java.security.krb5.debug", "true");
|
||||||
|
System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
|
||||||
|
GSAPPIConfiguration config = new GSAPPIConfiguration();
|
||||||
|
Configuration.setConfiguration(config);
|
||||||
|
}
|
||||||
|
|
||||||
boolean hasErrors = false;
|
boolean hasErrors = false;
|
||||||
String errorMessage = null;
|
String errorMessage = null;
|
||||||
@ -837,7 +869,7 @@ public final class LoginDialog {
|
|||||||
System.setProperty("https.proxyHost", host);
|
System.setProperty("https.proxyHost", host);
|
||||||
System.setProperty("https.proxyPort", port);
|
System.setProperty("https.proxyPort", port);
|
||||||
|
|
||||||
|
|
||||||
if (ModelUtil.hasLength(username) && ModelUtil.hasLength(password)) {
|
if (ModelUtil.hasLength(username) && ModelUtil.hasLength(password)) {
|
||||||
System.setProperty("http.proxyUser", username);
|
System.setProperty("http.proxyUser", username);
|
||||||
System.setProperty("http.proxyPassword", password);
|
System.setProperty("http.proxyPassword", password);
|
||||||
|
|||||||
BIN
src/resources/images/ajax-loader.gif
Normal file
BIN
src/resources/images/ajax-loader.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Reference in New Issue
Block a user