RE: [flexcoders] Authentication with Macromedia Flex
Hi Dimitrios, From reading through your earlierposts I get the impression that you are using a two methods to authenticate users. Initially, you authenticate the user using standard J2EE form based authentication. Then when using a service if you receive an authentication fault you use a flex popup window to re authenticate. Is this correct? Also, if you get a session time out do you resubmit the original service request after re-authentication? If so, what is the best way to generically resubmit the request? Regards, Allister - Original Message - From: Dimitrios Gianninas To: flexcoders@yahoogroups.com Sent: Monday, October 10, 2005 12:59 AM Subject: RE: [flexcoders] Authentication with Macromedia Flex I put theh handling of the failed authentication directly in the Services.mxml... simple and works. mx:Script function handleRemoteFault( event ):Void { if( event.fault.faultcode == "Client.Authentication" || event.fault.faultcode == "401" ) { // do whatever you want here, its a free country } else { event.call.faultHandler( event ); } } /mx:Script Dimitrios "Jimmy" Gianninas RIADeveloper Optimal Payments Inc. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Douglas KnudsenSent: Friday, October 07, 2005 9:53 AMTo: flexcoders@yahoogroups.comSubject: Re: [flexcoders] Authentication with Macromedia Flex so, I got auth working using the approach you mentionedCallbackHandler handler = new SimpleCallbackHandler( userName, password ); Subject subject = Authentication.login( handler ); ServletAuthentication.runAs( subject, httpRequest );silightly different looking under JRun of course. Now, I'm horribly stuck on getting the roles of the user after logging in. I have set up Roles under teh JMC, JRuns instance manager. I tested it all with BASIC auth, so I know the autentication and authorisation are working. I've been working all week on getting the roles for the user after authenticating and can't find squat of an example. Any hints perhaps?On a similar note... Using service.setUserNamePassword() in Flex I know it will authenticate a user, does it also authorise the user by gathering up the roles defined in the containers JAAS config?and one more concerning cairingrom to use service.setUserNamePassword() effectively, it appears you would need to modify the onfault event of a service in services.mxml file to check for a failed authentication. If not here then every command using the service would need this check, eh? What other way can this be done possibly? Create a AuthCommand abstract class to extend or something?DK On 10/7/05, Dimitrios Gianninas [EMAIL PROTECTED] wrote: Ah yes about accessing the session, I read that article as well. I plan to change this in the future, just haven't gotten there yet. Dimitrios "Jimmy" Gianninas RIADeveloper Optimal Payments Inc. From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Douglas KnudsenSent: Thursday, October 06, 2005 3:54 PM To: flexcoders@yahoogroups.comSubject: Re: [flexcoders] Authentication with Macromedia Flex http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=9636f34epss=rss_flex_9636f34e there.Thanks for the hint about using JAAS via CallBackHandler, etc in th eother thread...I have not got it working 100% on JRun yet...but still banging away at it.DK On 9/26/05, Dimitrios Gianninas [EMAIL PROTECTED] wrote: Where did you hear that it was not the approach to take? We have it working this way for one of our projects. Yes, when you user source="servlet", you must configure the source attribute in the remote-objects section of the flex-config.xml. You have to set it to the name of your context. So if your web application context is "localhost:8080/batman", then you must set: sourcebatman/source or for no security at all (don't do this in production): source*/source Dimitrios "Jimmy" Gianninas RIADeveloper Optimal Payments Inc. From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com] On Behalf Of Douglas KnudsenSent: Sunday, September 25, 2005 9:51 PMTo: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Authentication with Macromedia Flex I was under the impression this was not the approach to take in 1.5. IIRC, when messing with source= "servlet" I had to add some info to the flex.config file. Can you comment on this? Just curious as there seems to be so many ways to do this. DK On 9/24/05, Dimitrios Gianninas [EMAIL PROTECTED] wrote: Ok here is how to do this. Basically you will have a login.jsp page that will authenticate the user using FORM authentication. Once the user has logged in successfully, then you must retrieve the user
[flexcoders] Re: Remote Objects in Flex 1.5 Problem
Hi Graham, Thanks for the reply. It helped solve some follow up issues after I overcame the below problem. The cause of this problem was the fact that the action script class representing the java object was never specifically referenced in the action script code because arrays were being passed back and then being set on the Model object (ie no casting was needed). Once the VO Action Script class was imported into the command class then everything started working as per normal. Now in hindsight this makes sense because if there is no direct reference to the VO then flash never loads the class, therefore the Object.registerClass is never performed meaning no link exists between the VO and Java Object. If there is no link then when the object gets past back to a Remote Object flex server treats it like a ASObject rather than the required Java Object. This question is related to your reply. Is there some way of telling flex server not to pass final Static fields from Java to Flash? I have worked out how to do it from flash to Java using _global.ASSetPropFlags, but I would prefer that they are not sent to flash to start with. Thanks Again, Allister --- In flexcoders@yahoogroups.com, Graham, Jason [EMAIL PROTECTED] wrote: You have something in your class that the serialization layer is having a problem with. Make sure in your class you don't have any static final fields. This will cause a problem because the serialization layer going from java to flex sends these fields across, when you send the object back to java it blows up trying to set those fields. -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of allister_dickson Sent: Friday, February 24, 2006 12:16 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Remote Objects in Flex 1.5 Problem I am integrating a Flex frontend with a J2EE backend using Cairngorm Framework and RemoteObjects. I am able to successfully retrieve information from my java services, but when they are sent back after changes are made to the Java Service doesn't always recognise them as the correct type of Object, therefore causing a cast exception. After turning on debugging and logging in both the flex client and Java Server I have found the following things. 1) The flex server interprets the objects correctly when passing back the results. All the Typed objects are as expected see log below as an example: [0] = (Typed Object #1 'au.com.myplan.domain.financial.FinancialDefaultCategory') financialCategoryType = (Typed Object #5 'au.com.myplan.domain.financial.FinancialCategoryType') defaultAccountingTypeId = null selected = true _remoteClass = au.com.myplan.domain.financial.FinancialCategoryType description = isNested = true new = true name = Budget Income id = 1.0 accountingTypeId = null _remoteClass = au.com.myplan.domain.financial.FinancialDefaultCategory new = true name = Dividends subDefaultCategories = (Array #6) id = 43.0 2) When the object is viewed in the flex debugger only the associated object financialCategoryType has _remoteClass set and the parent object (FinancialDefaultCategory). 3) After changes are made and sent back to the Java Service the log only shows that it only understands the associated object and not the parent. [0] = (Object #6) id = 43.0 subDefaultCategories = (Array #7) name = Dividends Changed new = false accountingTypeId = null financialCategoryType = (Typed Object #8 'au.com.myplan.domain.financial.FinancialCategoryType') defaultAccountingTypeId = null selected = false _remoteClass = au.com.myplan.domain.financial.FinancialCategoryType description = isNested = false new = false name = Budget Income id = 1.0 parentFinancialDefaultCategory = null selected = true 4) When the Java Service receives the object it is of type ASObject. I have read and followed any examples I can find on the net, but I haven't found a way of forcing the Flex client to associate the objects recieved as the correct Action Script Class. The java log messages give the impression that it is configured correctly but when the object is in the flex client the _remoteClass is not set for the parent object. I have made sure that the ActionScript Classes have been register correctly (public static var regClass = Object.registerClass (au.com.myplan.domain.financial.FinancialDefaultCategory,au.com.myp lan.domain.financial.FinancialDefaultCategory);). Any help resolving this problem would
[flexcoders] Remote Objects in Flex 1.5 Problem
I am integrating a Flex frontend with a J2EE backend using Cairngorm Framework and RemoteObjects. I am able to successfully retrieve information from my java services, but when they are sent back after changes are made to the Java Service doesn't always recognise them as the correct type of Object, therefore causing a cast exception. After turning on debugging and logging in both the flex client and Java Server I have found the following things. 1) The flex server interprets the objects correctly when passing back the results. All the Typed objects are as expected see log below as an example: [0] = (Typed Object #1 'au.com.myplan.domain.financial.FinancialDefaultCategory') financialCategoryType = (Typed Object #5 'au.com.myplan.domain.financial.FinancialCategoryType') defaultAccountingTypeId = null selected = true _remoteClass = au.com.myplan.domain.financial.FinancialCategoryType description = isNested = true new = true name = Budget Income id = 1.0 accountingTypeId = null _remoteClass = au.com.myplan.domain.financial.FinancialDefaultCategory new = true name = Dividends subDefaultCategories = (Array #6) id = 43.0 2) When the object is viewed in the flex debugger only the associated object financialCategoryType has _remoteClass set and the parent object (FinancialDefaultCategory). 3) After changes are made and sent back to the Java Service the log only shows that it only understands the associated object and not the parent. [0] = (Object #6) id = 43.0 subDefaultCategories = (Array #7) name = Dividends Changed new = false accountingTypeId = null financialCategoryType = (Typed Object #8 'au.com.myplan.domain.financial.FinancialCategoryType') defaultAccountingTypeId = null selected = false _remoteClass = au.com.myplan.domain.financial.FinancialCategoryType description = isNested = false new = false name = Budget Income id = 1.0 parentFinancialDefaultCategory = null selected = true 4) When the Java Service receives the object it is of type ASObject. I have read and followed any examples I can find on the net, but I haven't found a way of forcing the Flex client to associate the objects recieved as the correct Action Script Class. The java log messages give the impression that it is configured correctly but when the object is in the flex client the _remoteClass is not set for the parent object. I have made sure that the ActionScript Classes have been register correctly (public static var regClass = Object.registerClass (au.com.myplan.domain.financial.FinancialDefaultCategory,au.com.myp lan.domain.financial.FinancialDefaultCategory);). Any help resolving this problem would be appreciated. Regards, Allister -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Remote Objects in Flex 1.5 Problem
I am integrating a Flex frontend with a J2EE backend using Cairngorm Framework and RemoteObjects. I am able to successfully retrieve information from my java services, but when they are sent back after changes are made to the Java Service doesn't always recognise them as the correct type of Object, therefore causing a cast exception. After turning on debugging and logging in both the flex client and Java Server I have found the following things. 1) The flex server interprets the objects correctly when passing back the results. All the Typed objects are as expected see log below as an example: [0] = (Typed Object #1 'au.com.myplan.domain.financial.FinancialDefaultCategory') financialCategoryType = (Typed Object #5 'au.com.myplan.domain.financial.FinancialCategoryType') defaultAccountingTypeId = null selected = true _remoteClass = au.com.myplan.domain.financial.FinancialCategoryType description = isNested = true new = true name = Budget Income id = 1.0 accountingTypeId = null _remoteClass = au.com.myplan.domain.financial.FinancialDefaultCategory new = true name = Dividends subDefaultCategories = (Array #6) id = 43.0 2) When the object is viewed in the flex debugger only the associated object financialCategoryType has _remoteClass set and the parent object (FinancialDefaultCategory). 3) After changes are made and sent back to the Java Service the log only shows that it only understands the associated object and not the parent. [0] = (Object #6) id = 43.0 subDefaultCategories = (Array #7) name = Dividends Changed new = false accountingTypeId = null financialCategoryType = (Typed Object #8 'au.com.myplan.domain.financial.FinancialCategoryType') defaultAccountingTypeId = null selected = false _remoteClass = au.com.myplan.domain.financial.FinancialCategoryType description = isNested = false new = false name = Budget Income id = 1.0 parentFinancialDefaultCategory = null selected = true 4) When the Java Service receives the object it is of type ASObject. I have read and followed any examples I can find on the net, but I haven't found a way of forcing the Flex client to associate the objects recieved as the correct Action Script Class. The java log messages give the impression that it is configured correctly but when the object is in the flex client the _remoteClass is not set for the parent object. I have made sure that the ActionScript Classes have been register correctly (public static var regClass = Object.registerClass (au.com.myplan.domain.financial.FinancialDefaultCategory,au.com.myp lan.domain.financial.FinancialDefaultCategory);). Any help resolving this problem would be appreciated. Regards, Allister -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/