Continue work on SSO.

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@8221 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro
2007-05-09 16:55:46 +00:00
committed by derek
parent a7e8d457e6
commit 537147d27b
3 changed files with 30 additions and 18 deletions

View File

@ -11,7 +11,7 @@
<excludeFolder url="file://$MODULE_DIR$/../../src/plugins" />
<excludeFolder url="file://$MODULE_DIR$/../../target" />
</content>
<orderEntry type="jdk" jdkName="1.6" jdkType="JavaSDK" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library" exported="">
<library>

View File

@ -661,23 +661,24 @@ public final class LoginDialog {
try {
lc = new LoginContext("GetPrincipal");
lc.login();
}
catch (LoginException le) {
Log.error(le);
}
Subject mySubject = lc.getSubject();
Subject mySubject = lc.getSubject();
for (Principal p : mySubject.getPrincipals()) {
String name = p.getName();
int indexOne = name.indexOf("@");
if (indexOne != -1) {
String realmName = name.substring(0, indexOne);
accountNameLabel.setText(realmName);
usernameField.setText(realmName);
for (Principal p : mySubject.getPrincipals()) {
String name = p.getName();
int indexOne = name.indexOf("@");
if (indexOne != -1) {
String realmName = name.substring(0, indexOne);
accountNameLabel.setText(realmName);
usernameField.setText(realmName);
}
loginButton.setEnabled(true);
}
}
catch (LoginException le) {
Log.debug(le.getMessage());
useSSO(false);
}
}
else {
autoLoginBox.setVisible(true);

View File

@ -179,7 +179,13 @@ public class LoginSettingDialog implements PropertyChangeListener {
ssoPanel.add(useSSOBox, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
final WrappedLabel wrappedLabel = new WrappedLabel();
String principalName = getPrincipalName();
String principalName = null;
try {
principalName = getPrincipalName();
}
catch (Exception e) {
// Ignore
}
if (ModelUtil.hasLength(principalName)) {
wrappedLabel.setText("This will use the Desktop Account for \"" + principalName + "\" to login to the server.");
}
@ -563,7 +569,13 @@ public class LoginSettingDialog implements PropertyChangeListener {
localPreferences.setHostAndPortConfigured(!isSelected);
}
private String getPrincipalName() {
/**
* Returns the principal name if one exists.
*
* @return the name (ex. derek) of the principal.
* @throws Exception thrown if a Principal was not found.
*/
private String getPrincipalName() throws Exception {
System.setProperty("java.security.krb5.debug", "true");
System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
GSAPPIConfiguration config = new GSAPPIConfiguration();
@ -575,7 +587,7 @@ public class LoginSettingDialog implements PropertyChangeListener {
lc.login();
}
catch (LoginException le) {
Log.error(le);
Log.debug(le.getMessage());
return null;
}
@ -585,8 +597,7 @@ public class LoginSettingDialog implements PropertyChangeListener {
String name = p.getName();
int indexOne = name.indexOf("@");
if (indexOne != -1) {
String realmName = name.substring(0, indexOne);
return realmName;
return name.substring(0, indexOne);
}
}
return null;