summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Anderson <jander@mit.edu>2008-10-29 21:58:56 +0000
committerJustin Anderson <jander@mit.edu>2008-10-29 21:58:56 +0000
commit131ac802ba0975a047c72f010657f3200b9a2be5 (patch)
tree96cd5b7dc3d9c6f96f1fbee2c44ce78faf217acb
parent1b8736d37a2672c83f02ce73916dc12da94013ac (diff)
downloadkrb5-131ac802ba0975a047c72f010657f3200b9a2be5.tar.gz
krb5-131ac802ba0975a047c72f010657f3200b9a2be5.tar.xz
krb5-131ac802ba0975a047c72f010657f3200b9a2be5.zip
KerberosAgent now saves successfully authenticated identities to favorites automatically when they were acquired through the Enter Identity dialog
ticket: 6222 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20940 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/kim/agent/mac/IPCClient.h2
-rw-r--r--src/kim/agent/mac/IPCClient.m23
-rw-r--r--src/kim/agent/mac/Identities.m2
3 files changed, 26 insertions, 1 deletions
diff --git a/src/kim/agent/mac/IPCClient.h b/src/kim/agent/mac/IPCClient.h
index 361c4283a..0bea6000b 100644
--- a/src/kim/agent/mac/IPCClient.h
+++ b/src/kim/agent/mac/IPCClient.h
@@ -28,6 +28,7 @@
@class SelectIdentityController;
@class AuthenticationController;
+@class Identities;
@interface IPCClient : NSObject {
mach_port_t port;
@@ -49,6 +50,7 @@
@property (readonly, retain) AuthenticationController *authController;
- (void) cleanup;
+- (void) saveIdentityToFavoritesIfSuccessful;
- (kim_error) selectIdentity: (NSDictionary *) info;
- (kim_error) enterIdentity: (NSDictionary *) info;
diff --git a/src/kim/agent/mac/IPCClient.m b/src/kim/agent/mac/IPCClient.m
index 53a7fe540..d4ac8a699 100644
--- a/src/kim/agent/mac/IPCClient.m
+++ b/src/kim/agent/mac/IPCClient.m
@@ -27,6 +27,7 @@
#import "SelectIdentityController.h"
#import "AuthenticationController.h"
#import "KerberosAgentListener.h"
+#import "Identities.h"
enum krb_agent_client_state {
ipc_client_state_idle,
@@ -105,6 +106,9 @@ enum krb_agent_client_state {
- (void) cleanup
{
+ if (![[self.selectController window] isVisible]) {
+ [self saveIdentityToFavoritesIfSuccessful];
+ }
[self.selectController close];
[self.authController close];
self.selectController = nil;
@@ -112,6 +116,25 @@ enum krb_agent_client_state {
self.currentInfo = nil;
}
+- (void) saveIdentityToFavoritesIfSuccessful
+{
+ NSString *identityString = [self.currentInfo valueForKeyPath:@"identity_string"];
+ NSDictionary *options = [self.currentInfo valueForKeyPath:@"options"];
+
+ Identities *identities = [[Identities alloc] init];
+ Identity *theIdentity = [[Identity alloc] initWithIdentity:identityString
+ options:options];
+ for (Identity *anIdentity in [identities identities]) {
+ if ([anIdentity isEqual:theIdentity]) {
+ if (!anIdentity.favorite) {
+ anIdentity.favorite = YES;
+ [identities synchronizePreferences];
+ }
+ break;
+ }
+ }
+}
+
- (void) didCancel
{
kim_error err = KIM_USER_CANCELED_ERR;
diff --git a/src/kim/agent/mac/Identities.m b/src/kim/agent/mac/Identities.m
index 13c7578f7..1fa7e6ef4 100644
--- a/src/kim/agent/mac/Identities.m
+++ b/src/kim/agent/mac/Identities.m
@@ -477,7 +477,7 @@
}
//NSLog(@"waited %@", [[NSThread currentThread] description]);
- [(Identities *) [connection rootProxy] update];
+ [(Identities *) [connection rootProxy] reload];
sleep (1);
}