New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Safari + Keychain


Post Reply New Thread Subscribe

 
Thread Tools
eddietec

 
Member Since: Mar 02, 2010
Posts: 3
eddietec is on a distinguished road

eddietec is offline
Hi,

I need to build an application that will save some internet passwords in Keychain in order to avoid Safari to prompt them when those sites are browsed.

Do you know how to accomplish it? Adding url in KeyChain is not enough, and I'm not sure how to notify Safari to use an item storage in KeyChain...

Thanks in advance.
QUOTE Thanks
TattooedMac

 
TattooedMac's Avatar
 
Member Since: May 19, 2009
Location: Waiting for a mate . . .
Posts: 7,860
TattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant future
Mac Specs: 21" iMac 2.9Ghz 10.9.4 13"MBP 2.9Ghz i7 Yosemite 10.10 ~ iPhone5 iOS 8 ~ iPad Mini iOS 8 ~ ATV3 6.1

TattooedMac is offline
Hey eddietec welcome.
You shouldnt even have to access keychain ?? I just might not be following your question either

Say im logging into MF for the 1st time, my username then password then click the remember me box, then everytime i log in, i get logged straight in ......

Unless im missing something techie then keychain works great just like that

Cheers

CogFrog Studio's ~ Photography, Apps and Web Development
Dont forget to use the Reputation System if someone has helped you out !!!
Arguing with a zealot is only slightly easier than tunneling through a mountain with your forehead!!!!!
QUOTE Thanks
eddietec

 
Member Since: Mar 02, 2010
Posts: 3
eddietec is on a distinguished road

eddietec is offline
Hi,

Issue is that I have almost 100 intranets portals that some clients used (because they are not in Active Directory they are prompt to input user+password), we want to use KeyChain to avoid them to input that information for each site. This application will be in charge to add/upgrade logins/passwords for those sites. Problem is that how to add items in keychain in a way Safari can recognize them?

Best regards.
QUOTE Thanks
TattooedMac

 
TattooedMac's Avatar
 
Member Since: May 19, 2009
Location: Waiting for a mate . . .
Posts: 7,860
TattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant future
Mac Specs: 21" iMac 2.9Ghz 10.9.4 13"MBP 2.9Ghz i7 Yosemite 10.10 ~ iPhone5 iOS 8 ~ iPad Mini iOS 8 ~ ATV3 6.1

TattooedMac is offline
Ahh no worries then. Ill admit it is a little over my head lol
Give it time though, someone should be able to come up with the answer your looking for. Good luck with it

Cheers

CogFrog Studio's ~ Photography, Apps and Web Development
Dont forget to use the Reputation System if someone has helped you out !!!
Arguing with a zealot is only slightly easier than tunneling through a mountain with your forehead!!!!!
QUOTE Thanks
eddietec

 
Member Since: Mar 02, 2010
Posts: 3
eddietec is on a distinguished road

eddietec is offline
Hi,

Here is the answer. Safari sets a property in keychain item that only by code can be set/get. This property is kSecSecurityDomainItemAttr. Following code configures one custom key to make it work with Safari:

Code:
- (void) updateSecKeychainItemRef:(SecKeychainItemRef)item
{    
    SecKeychainAttribute attributes[50];
    SecKeychainAttributeList list;
    OSStatus status;
    
    attributes[0].tag = kSecSecurityDomainItemAttr;
    attributes[0].data = "wwww.portaWithActiveDirectory.com";
    attributes[0].length = strlen("wwww.portaWithActiveDirectory.com");
    list.count = 1;
    
    list.attr = attributes;
    //status = SecKeychainItemModifyContent(item, &list, strlen(PWD), PWD);
    status = SecKeychainItemModifyContent(item, &list, 0, NULL);
    
    if (status == noErr) {
        NSLog(@"\tChanged OK\n");        
    } 
    else {
        NSString *errorMsg = (NSString*) SecCopyErrorMessageString(status, NULL);
        NSLog(@"Error in updateSecKeychainItemRef = %d, %@\n", 
                (int)status, errorMsg);
    }
}
Cheers, Eddie.
QUOTE Thanks

Post Reply New Thread Subscribe


« Can't save change in IB for Tiger | Wine Help »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Safari Keychain Access Rokurosv OS X - Operating System 2 10-07-2009 12:06 AM
Keychain Message When Opening Safari TiltedKilt OS X - Apps and Games 3 08-26-2007 05:10 PM
Safari 'Please enter keychain password'...really annoying! HELP! jetpilot_aust OS X - Operating System 7 04-17-2007 07:48 AM
Stop the keychain pop up while using safari vishal.chauhan OS X - Operating System 3 12-21-2006 08:34 AM
Keychain and Safari gtee OS X - Operating System 1 07-04-2005 11:08 AM

All times are GMT -4. The time now is 09:29 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?