On 2/25/10 3:09 AM, "sergio_101" <sergiol...@village-buzz.com> wrote: > part of my app requires an authenticated login to last.fm as in: > > http://www.last.fm/api/webauth > > my question is: > > how to i start a browser session in smalltalk to set up the > authenticated connection, then run through each of the api calls i > will need to make? > > thanks! > > -- > > ---- > peace, > sergio > photographer, journalist, visionary Before my new duties as Release manager, was development a new version of Squeak Swiki using HV2 on top of Kom. Share some tips The starting point Web app HVTransientView subclass: #HVNaughtieWiki You must have in the class side rootView ^ HVNaughtieWikiRoot createModel ^ HVNaughtieWiki new I attach the subclass of KomAuthDb and the class which is the root and say where and how you log and which authenticated use. Original KomAuthDb uses user and password, you could see my in progress thing use some more complex. A typical user record is 'user' an OrderedCollection('m...@mail.com' '4/3/2005' 'nIxbXj1vR') And a typical log is 127.0.0.1 - garduino [23/Feb/2010:07:42:52] "GET /schemes/squeak/topborder.gif HTTP/1.1" 200 44 127.0.0.1 - garduino [23/Feb/2010:07:42:52] "GET /schemes/squeak/squeak-green.gif HTTP/1.1" 200 1905 127.0.0.1 - garduino [23/Feb/2010:07:42:52] "GET /schemes/squeak/Catcha.gif HTTP/1.1" 200 1183 Hope this helps Edgar
'From MinimalMorphic of 8 December 2006 [latest update: #7246] on 25 February 2010 at 7:15:51 am'! KomAuthDb subclass: #HVNaughtieUsers instanceVariableNames: '' classVariableNames: 'DataBase Logs' poolDictionaries: '' category: 'NaughtieWiki'! !HVNaughtieUsers methodsFor: 'as yet unclassified' stamp: 'edc 2/15/2010 18:19'! encode: password ^ password! ! !HVNaughtieUsers methodsFor: 'as yet unclassified' stamp: 'edc 2/25/2010 07:15'! verifyPassword: aPassword forUser: userName | log | log := self class getDataBase at: userName ifAbsent: [^ false]. ^ log last = aPassword! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! HVNaughtieUsers class instanceVariableNames: ''! !HVNaughtieUsers class methodsFor: 'as yet unclassified' stamp: 'edc 2/15/2010 18:18'! addUser: user mail: mail self halt.! ! !HVNaughtieUsers class methodsFor: 'as yet unclassified' stamp: 'edc 2/15/2010 18:06'! getDataBase " HVNaughtieUsers getDataBase " ^ DataBase! ! !HVNaughtieUsers class methodsFor: 'as yet unclassified' stamp: 'edc 2/15/2010 17:57'! setDataBase: anObject DataBase := anObject! !
'From MinimalMorphic of 8 December 2006 [latest update: #7246] on 25 February 2010 at 7:16:25 am'! HVRootView subclass: #HVNaughtieWikiRoot instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'NaughtieWiki'! !HVNaughtieWikiRoot methodsFor: 'start-stop' stamp: 'edc 2/25/2010 07:16'! startOn: portNum mode: mode "Creates a new standalone http service with this root view plugged in." | name ma authdb | Transcript clear. name := viewClass ifNil: [self class name] ifNotNil: [viewClass name]. ma := ModuleAssembly core. coreMod := ma currentModule. ma logTo: (KomLogger on: (FileStream oldFileNamed: 'server.log')). ma alias: '/squeak' to: [ma logTo: (KomLogger on: Transcript)]. ma alias: '/busca' to: [ma logTo: (KomLogger on: Transcript)]. authdb := HVNaughtieUsers new. ma authenticate: authdb realm: 'HVNaughtie'. ma trackSessions. sessionMod := ma currentModule. ma sessionTimeout: 1. alias = '' ifTrue: [ma addPlug: [:request | self process: request]] ifFalse: [ma alias: alias to: [ma addPlug: [:request | self process: request]]]. ^ (HttpService startOn: portNum named: name) plug: ma rootModule; mode: mode! !
_______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners