|
»
custom authentication and participant
|
View:
New views
10 Messages
—
Rating Filter:
Alert me
|
|
|
custom authentication and participantHi, I am working on my first Rife project and I need to authenticate my users against a SOAP server. To do this, assuming I have understood the way it works, I have written a class that implements CredentialsManagerFactory to return my own CredentialsManager. I have added a credentialsmanagerfactory_class property to my authentication element. I have two questions though: - Should I use the memory-based or the db authentication? Does it matter at all since I won't use either the users xml file or the user table? Or should I not add any participant for the authentication in my participants.xml? - If I need to declare a participant, how should I declare it? No users.xml param or no datasource? Rodrigue --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "rife-users" group. To post to this group, send email to rife-users@... To unsubscribe from this group, send email to rife-users-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rife-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: custom authentication and participantHi, I have written a CredentialsManager to. I am not sure how this rife magic works but this is my configuration: main.xml: <element id="AuthClient" extends="rife/authenticated/memory.xml"> <property name="password_encryption">SHA</property> <property name="role">Client,Admin</property> <!-- <property name="role">Admin</property> --> <property name="authvar_type">cookie</property> <property name="template_name">authentication.admin</property> <property name="credentialsmanagerfactory_class">de.sourcepark.ms2.rife.MS2CredentialsManagerFactory</property> <submission name="credentials"> <param name="login"/> <param name="password"/> </submission> <childtrigger name="authid"/> </element> <element id="CustomerChangePw" implementation="de.sourcepark.ms2.rife.customer.EditCustomerPw" url="/customerchangepw" inherits="AuthClient"> <inbean name="customer" prefix="pre_" classname="de.sourcepark.ms2.rife.customer.CBCustomerPwEdit"/> <outbean name="customer" prefix="pre_" classname="de.sourcepark.ms2.rife.customer.CBCustomerActiveEdit"/> <autolink srcexit="ClientCustomerEdit"/> <autolink srcexit="CustomerChangePw"/> </element> this works perfect for me. Hope this helps. Ciao Matthias Rodrigue wrote: > Hi, > > I am working on my first Rife project and I need to authenticate my > users against a SOAP server. To do this, assuming I have understood > the way it works, I have written a class that implements > CredentialsManagerFactory to return my own CredentialsManager. I have > added a credentialsmanagerfactory_class property to my authentication > element. I have two questions though: > > - Should I use the memory-based or the db authentication? Does it > matter at all since I won't use either the users xml file or the user > table? Or should I not add any participant for the authentication in > my participants.xml? > - If I need to declare a participant, how should I declare it? No > users.xml param or no datasource? > > Rodrigue > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "rife-users" group. To post to this group, send email to rife-users@... To unsubscribe from this group, send email to rife-users-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rife-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: custom authentication and participantHi Matthias, Thank you for your reply. I actually have the authentication working as well. However I am now struggling to set and get values in the session once the authentication is successful. Basically, once the credentials are checked and correct, I want to add 2 variables in the session so that all the elements in the subsite that inherits from AUTH can have access to them. I thought this should be done with global variables but I don't know how to set and get them. I have tried to extend the RoleUserAuthenticated class and do a setOutput() inside the acceptedCredentials() hook. I ran into an exception saying "beanClass cannot be null" thrown by ElementSupport.generateEmptyForm(). Are you trying to do something similar with your inbean and outbean? If so, how does the inbean gets created and populated? I have spent a few hours reading the wiki, the cookbook, the javadoc, the source code, and I am now confused on how to do what I want. Also, how to get access to the credentials object from an element that inherits from AUTH? It seems tht it is possible only if you have the 'login' value...Really, I don't know where to look now. I'd really appreciate any help. Rodrigue On Jun 18, 5:02 pm, Matthias Barmeier <matthias.barme...@...> wrote: > Hi, > > I have written a CredentialsManager to. I am not sure how this rife > magic works but this is my configuration: > > main.xml: > > <element id="AuthClient" extends="rife/authenticated/memory.xml"> > <property name="password_encryption">SHA</property> > <property name="role">Client,Admin</property> > <!-- <property name="role">Admin</property> --> > <property name="authvar_type">cookie</property> > <property name="template_name">authentication.admin</property> > <property > name="credentialsmanagerfactory_class">de.sourcepark.ms2.rife.MS2CredentialsManagerFactory</property> > <submission name="credentials"> > <param name="login"/> > <param name="password"/> > </submission> > > <childtrigger name="authid"/> > </element> > > <element id="CustomerChangePw" > > implementation="de.sourcepark.ms2.rife.customer.EditCustomerPw" > url="/customerchangepw" inherits="AuthClient"> > <inbean name="customer" prefix="pre_" > > classname="de.sourcepark.ms2.rife.customer.CBCustomerPwEdit"/> > <outbean name="customer" prefix="pre_" > > classname="de.sourcepark.ms2.rife.customer.CBCustomerActiveEdit"/> > <autolink srcexit="ClientCustomerEdit"/> > <autolink srcexit="CustomerChangePw"/> > > </element> > > this works perfect for me. > > Hope this helps. > > Ciao > Matthias > > Rodrigue wrote: > > Hi, > > > I am working on my first Rife project and I need to authenticate my > > users against a SOAP server. To do this, assuming I have understood > > the way it works, I have written a class that implements > > CredentialsManagerFactory to return my own CredentialsManager. I have > > added a credentialsmanagerfactory_class property to my authentication > > element. I have two questions though: > > > - Should I use the memory-based or the db authentication? Does it > > matter at all since I won't use either the users xml file or the user > > table? Or should I not add any participant for the authentication in > > my participants.xml? > > - If I need to declare a participant, how should I declare it? No > > users.xml param or no datasource? > > > Rodrigue You received this message because you are subscribed to the Google Groups "rife-users" group. To post to this group, send email to rife-users@... To unsubscribe from this group, send email to rife-users-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rife-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: custom authentication and participantHi Rodrigue, I use an entry element class as arrival: <arrival destid="EntryElement"/> The EntryElement is configured like: <element id="Entry" implementation="de.sourcepark.ms2.rife.EntryElement" inherits="AuthClient"> <outbean name="customer" prefix="pre_" classname="de.sourcepark.ms2.rife.customer.CBCustomerActiveEdit"/> <autolink srcexit="ClientCustomerEdit"/> <autolink srcexit="CustomerChangePw"/> </element> In the class I can call: RoleUserIdentity identity = (RoleUserIdentity)getRequestAttribute(Identified.IDENTITY_ATTRIBUTE_NAME); to get the identity object and then: identity.getLogin() To get the username. In the EntryElement you can set if you like a global var to reflect the logged in user and his role. Hope this helps. Ciao Matthias Rodrigue wrote: > Hi Matthias, > > Thank you for your reply. I actually have the authentication working > as well. However I am now struggling to set and get values in the > session once the authentication is successful. Basically, once the > credentials are checked and correct, I want to add 2 variables in the > session so that all the elements in the subsite that inherits from > AUTH can have access to them. > > I thought this should be done with global variables but I don't know > how to set and get them. I have tried to extend the > RoleUserAuthenticated class and do a setOutput() inside the > acceptedCredentials() hook. I ran into an exception saying "beanClass > cannot be null" thrown by ElementSupport.generateEmptyForm(). > > Are you trying to do something similar with your inbean and outbean? > If so, how does the inbean gets created and populated? > > I have spent a few hours reading the wiki, the cookbook, the javadoc, > the source code, and I am now confused on how to do what I want. Also, > how to get access to the credentials object from an element that > inherits from AUTH? It seems tht it is possible only if you have the > 'login' value...Really, I don't know where to look now. > > I'd really appreciate any help. > > Rodrigue > > On Jun 18, 5:02 pm, Matthias Barmeier > <matthias.barme...@...> wrote: > >> Hi, >> >> I have written a CredentialsManager to. I am not sure how this rife >> magic works but this is my configuration: >> >> main.xml: >> >> <element id="AuthClient" extends="rife/authenticated/memory.xml"> >> <property name="password_encryption">SHA</property> >> <property name="role">Client,Admin</property> >> <!-- <property name="role">Admin</property> --> >> <property name="authvar_type">cookie</property> >> <property name="template_name">authentication.admin</property> >> <property >> name="credentialsmanagerfactory_class">de.sourcepark.ms2.rife.MS2CredentialsManagerFactory</property> >> <submission name="credentials"> >> <param name="login"/> >> <param name="password"/> >> </submission> >> >> <childtrigger name="authid"/> >> </element> >> >> <element id="CustomerChangePw" >> >> implementation="de.sourcepark.ms2.rife.customer.EditCustomerPw" >> url="/customerchangepw" inherits="AuthClient"> >> <inbean name="customer" prefix="pre_" >> >> classname="de.sourcepark.ms2.rife.customer.CBCustomerPwEdit"/> >> <outbean name="customer" prefix="pre_" >> >> classname="de.sourcepark.ms2.rife.customer.CBCustomerActiveEdit"/> >> <autolink srcexit="ClientCustomerEdit"/> >> <autolink srcexit="CustomerChangePw"/> >> >> </element> >> >> this works perfect for me. >> >> Hope this helps. >> >> Ciao >> Matthias >> >> Rodrigue wrote: >> >>> Hi, >>> >>> I am working on my first Rife project and I need to authenticate my >>> users against a SOAP server. To do this, assuming I have understood >>> the way it works, I have written a class that implements >>> CredentialsManagerFactory to return my own CredentialsManager. I have >>> added a credentialsmanagerfactory_class property to my authentication >>> element. I have two questions though: >>> >>> - Should I use the memory-based or the db authentication? Does it >>> matter at all since I won't use either the users xml file or the user >>> table? Or should I not add any participant for the authentication in >>> my participants.xml? >>> - If I need to declare a participant, how should I declare it? No >>> users.xml param or no datasource? >>> >>> Rodrigue >>> > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "rife-users" group. To post to this group, send email to rife-users@... To unsubscribe from this group, send email to rife-users-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rife-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: custom authentication and participantHi Matthias, thank you again for your reply. I still have some trouble though. When I call RoleUserIdentity identity = (RoleUserIdentity)getRequestAttribute(Identified.IDENTITY_ATTRIBUTE_NAME); the identity is null. After looking at the rife source code I found out that this is because my credentials manager does not implement IdentifiableUsersManager. So I am now wondering what does your de.sourcepark.ms2.rife.MS2CredentialsManagerFactory return in getCredentialsManager? Have you written your own CredentialsManager that also implements IdentifiableUsersManager? Rodrigue On Jun 19, 9:57 am, Matthias Barmeier <matthias.barme...@...> wrote: > Hi Rodrigue, > > I use an entry element class as arrival: > > <arrival destid="EntryElement"/> > > The EntryElement is configured like: > > <element id="Entry" > implementation="de.sourcepark.ms2.rife.EntryElement" inherits="AuthClient"> > <outbean name="customer" prefix="pre_" > > classname="de.sourcepark.ms2.rife.customer.CBCustomerActiveEdit"/> > <autolink srcexit="ClientCustomerEdit"/> > <autolink srcexit="CustomerChangePw"/> > </element> > > In the class I can call: > > RoleUserIdentity identity = > (RoleUserIdentity)getRequestAttribute(Identified.IDENTITY_ATTRIBUTE_NAME); > > to get the identity object and then: > > identity.getLogin() > > To get the username. In the EntryElement you can set if you like a > global var to reflect the logged in user and his role. > > Hope this helps. > > Ciao > Matthias > > Rodrigue wrote: > > Hi Matthias, > > > Thank you for your reply. I actually have the authentication working > > as well. However I am now struggling to set and get values in the > > session once the authentication is successful. Basically, once the > > credentials are checked and correct, I want to add 2 variables in the > > session so that all the elements in the subsite that inherits from > > AUTH can have access to them. > > > I thought this should be done with global variables but I don't know > > how to set and get them. I have tried to extend the > > RoleUserAuthenticated class and do a setOutput() inside the > > acceptedCredentials() hook. I ran into an exception saying "beanClass > > cannot be null" thrown by ElementSupport.generateEmptyForm(). > > > Are you trying to do something similar with your inbean and outbean? > > If so, how does the inbean gets created and populated? > > > I have spent a few hours reading the wiki, the cookbook, the javadoc, > > the source code, and I am now confused on how to do what I want. Also, > > how to get access to the credentials object from an element that > > inherits from AUTH? It seems tht it is possible only if you have the > > 'login' value...Really, I don't know where to look now. > > > I'd really appreciate any help. > > > Rodrigue > > > On Jun 18, 5:02 pm, Matthias Barmeier > > <matthias.barme...@...> wrote: > > >> Hi, > > >> I have written a CredentialsManager to. I am not sure how this rife > >> magic works but this is my configuration: > > >> main.xml: > > >> <element id="AuthClient" extends="rife/authenticated/memory.xml"> > >> <property name="password_encryption">SHA</property> > >> <property name="role">Client,Admin</property> > >> <!-- <property name="role">Admin</property> --> > >> <property name="authvar_type">cookie</property> > >> <property name="template_name">authentication.admin</property> > >> <property > >> name="credentialsmanagerfactory_class">de.sourcepark.ms2.rife.MS2CredentialsManagerFactory</property> > >> <submission name="credentials"> > >> <param name="login"/> > >> <param name="password"/> > >> </submission> > > >> <childtrigger name="authid"/> > >> </element> > > >> <element id="CustomerChangePw" > > >> implementation="de.sourcepark.ms2.rife.customer.EditCustomerPw" > >> url="/customerchangepw" inherits="AuthClient"> > >> <inbean name="customer" prefix="pre_" > > >> classname="de.sourcepark.ms2.rife.customer.CBCustomerPwEdit"/> > >> <outbean name="customer" prefix="pre_" > > >> classname="de.sourcepark.ms2.rife.customer.CBCustomerActiveEdit"/> > >> <autolink srcexit="ClientCustomerEdit"/> > >> <autolink srcexit="CustomerChangePw"/> > > >> </element> > > >> this works perfect for me. > > >> Hope this helps. > > >> Ciao > >> Matthias > > >> Rodrigue wrote: > > >>> Hi, > > >>> I am working on my first Rife project and I need to authenticate my > >>> users against a SOAP server. To do this, assuming I have understood > >>> the way it works, I have written a class that implements > >>> CredentialsManagerFactory to return my own CredentialsManager. I have > >>> added a credentialsmanagerfactory_class property to my authentication > >>> element. I have two questions though: > > >>> - Should I use the memory-based or the db authentication? Does it > >>> matter at all since I won't use either the users xml file or the user > >>> table? Or should I not add any participant for the authentication in > >>> my participants.xml? > >>> - If I need to declare a participant, how should I declare it? No > >>> users.xml param or no datasource? > > >>> Rodrigue You received this message because you are subscribed to the Google Groups "rife-users" group. To post to this group, send email to rife-users@... To unsubscribe from this group, send email to rife-users-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rife-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: custom authentication and participantHi Rodrigue, my Factory is really simple: package de.sourcepark.ms2.rife; import com.uwyn.rife.authentication.CredentialsManager; import com.uwyn.rife.authentication.credentialsmanagers.CredentialsManagerFactory; import com.uwyn.rife.ioc.HierarchicalProperties; import com.uwyn.rife.ioc.exceptions.PropertyValueException; No Id on have a Manager that implementes the interface you mentioned my decalaration is: public class MS2CredentialsManager implements CredentialsManager, RoleUsersManager What I have copied from some examples and not really understand is this main.xml element: <element id="IDENTIFIED" extends="rife/authenticated/identified.xml"> <property name="authElementId">AuthClient</property> <childtrigger name="authid"/> </element> May be this creates the things you need on the fly. Ciao Matthias Rodrigue wrote: > Hi Matthias, > > thank you again for your reply. I still have some trouble though. > > When I call > > RoleUserIdentity identity = > (RoleUserIdentity)getRequestAttribute(Identified.IDENTITY_ATTRIBUTE_NAME); > > the identity is null. After looking at the rife source code I found > out that this is because my credentials manager does not implement > IdentifiableUsersManager. So I am now wondering what does your > de.sourcepark.ms2.rife.MS2CredentialsManagerFactory return in > getCredentialsManager? > Have you written your own CredentialsManager that also implements > IdentifiableUsersManager? > > Rodrigue > > > > On Jun 19, 9:57 am, Matthias Barmeier > <matthias.barme...@...> wrote: > >> Hi Rodrigue, >> >> I use an entry element class as arrival: >> >> <arrival destid="EntryElement"/> >> >> The EntryElement is configured like: >> >> <element id="Entry" >> implementation="de.sourcepark.ms2.rife.EntryElement" inherits="AuthClient"> >> <outbean name="customer" prefix="pre_" >> >> classname="de.sourcepark.ms2.rife.customer.CBCustomerActiveEdit"/> >> <autolink srcexit="ClientCustomerEdit"/> >> <autolink srcexit="CustomerChangePw"/> >> </element> >> >> In the class I can call: >> >> RoleUserIdentity identity = >> (RoleUserIdentity)getRequestAttribute(Identified.IDENTITY_ATTRIBUTE_NAME); >> >> to get the identity object and then: >> >> identity.getLogin() >> >> To get the username. In the EntryElement you can set if you like a >> global var to reflect the logged in user and his role. >> >> Hope this helps. >> >> Ciao >> Matthias >> >> Rodrigue wrote: >> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "rife-users" group. To post to this group, send email to rife-users@... To unsubscribe from this group, send email to rife-users-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rife-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: custom authentication and participantHi Matthias, I have finally managed to do what I wanted to do, maybe not in the best way though. You didn't have to explicitly worry about the IdentifiableUsersManager interface because your custom manager implements RoleUsersManager, which extends IdentifiableUsersManager. Still, you certainly had to implement getLogin() and getAttributes(). I only implement IdentifiableUsersManager because I don't need the role feature. However, I have written a custom class that extends RoleUsersAttributes so that the getAttributes() method on the RoleUserIdentity returns my custom object in which I can store more information than just login, password, and role. I read the user's guide section on managing user data ( http://rifers.org/wiki/display/RIFE/GuideDatabaseUsers#GuideDatabaseUsers-sect1additionaldata ) but wasn't sure how to link that to my custom credentials manager. Also, about your IDENTIFIED element, I don't think it is used at all unless you have other elements that inherits from it, so I wasn't sure either about how to use it. Anyway, my application works at the moment so I will keep going even though I doubt I am really managing my user data the best way. Also, some details of rife are still obscure to me. I am not sure how the identity information is saved. I think it is sent to the client and I don't know how to explicitly keep it on the server side (which, in my understanding, would require defining a db table). All that is a bit of thinking aloud but maybe it can help somebody who'll read it. In the meantime, I'll keep tinkering with rife until I understand it more. At any rate, thanks for your help. Rodrigue On Jun 19, 11:09 am, Matthias Barmeier <matthias.barme...@...> wrote: > Hi Rodrigue, > > my Factory is really simple: > > package de.sourcepark.ms2.rife; > > import com.uwyn.rife.authentication.CredentialsManager; > import > com.uwyn.rife.authentication.credentialsmanagers.CredentialsManagerFactory; > import com.uwyn.rife.ioc.HierarchicalProperties; > import com.uwyn.rife.ioc.exceptions.PropertyValueException; > > No Id on have a Manager that implementes the interface you mentioned my > decalaration is: > > public class MS2CredentialsManager implements CredentialsManager, > RoleUsersManager > > What I have copied from some examples and not really understand is this > main.xml element: > > <element id="IDENTIFIED" > extends="rife/authenticated/identified.xml"> > <property name="authElementId">AuthClient</property> > <childtrigger name="authid"/> > </element> > > May be this creates the things you need on the fly. > > Ciao > Matthias > > Rodrigue wrote: > > Hi Matthias, > > > thank you again for your reply. I still have some trouble though. > > > When I call > > > RoleUserIdentity identity = > > (RoleUserIdentity)getRequestAttribute(Identified.IDENTITY_ATTRIBUTE_NAME); > > > the identity is null. After looking at the rife source code I found > > out that this is because my credentials manager does not implement > > IdentifiableUsersManager. So I am now wondering what does your > > de.sourcepark.ms2.rife.MS2CredentialsManagerFactory return in > > getCredentialsManager? > > Have you written your own CredentialsManager that also implements > > IdentifiableUsersManager? > > > Rodrigue > > > On Jun 19, 9:57 am, Matthias Barmeier > > <matthias.barme...@...> wrote: > > >> Hi Rodrigue, > > >> I use an entry element class as arrival: > > >> <arrival destid="EntryElement"/> > > >> The EntryElement is configured like: > > >> <element id="Entry" > >> implementation="de.sourcepark.ms2.rife.EntryElement" inherits="AuthClient"> > >> <outbean name="customer" prefix="pre_" > > >> classname="de.sourcepark.ms2.rife.customer.CBCustomerActiveEdit"/> > >> <autolink srcexit="ClientCustomerEdit"/> > >> <autolink srcexit="CustomerChangePw"/> > >> </element> > > >> In the class I can call: > > >> RoleUserIdentity identity = > >> (RoleUserIdentity)getRequestAttribute(Identified.IDENTITY_ATTRIBUTE_NAME); > > >> to get the identity object and then: > > >> identity.getLogin() > > >> To get the username. In the EntryElement you can set if you like a > >> global var to reflect the logged in user and his role. > > >> Hope this helps. > > >> Ciao > >> Matthias > > >> Rodrigue wrote: You received this message because you are subscribed to the Google Groups "rife-users" group. To post to this group, send email to rife-users@... To unsubscribe from this group, send email to rife-users-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rife-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: custom authentication and participantHi Rodrigue, sorry that the documentation is a bit lacking in this regard. Have you read through this http://rifers.org/wiki/display/RIFE/Authentication+system+internals ? I think that you should be able to get a better idea of how the authentication internals work. Also make sure to read the Javadoc of the relevant interfaces/classes. As far as storing variables somewhere after the authentication proceeds, this can be done in several ways. First, if you only want this to be available to all the other elements in the same request, it's best to use request attributes for this: http://rifers.org/docs/api/com/uwyn/rife/engine/ElementSupport.html#setRequestAttribute(java.lang.String,%20java.lang.Object) This is what the identified element does. Of course, for that to work, you have to make sure that your authentication element executes before the rest, either by having it precede the others: http://rifers.org/wiki/display/RIFE/Precedence or by embedding it into your template and give it a high priority: http://rifers.org/wiki/display/RIFE/Embedded+element+priorities If you want to store these variables for a longer time, you can still access the regular HTTP session within RIFE, you just have to turn on raw access: http://rifers.org/docs/api/com/uwyn/rife/engine/ElementSupport.html#setProhibitRawAccess(boolean) After that you can use the unmanaged HTTP request and access the session: http://rifers.org/docs/api/com/uwyn/rife/engine/ElementSupport.html#getHttpServletRequest() Other ways of doing this is by creating stateful components: http://rifers.org/wiki/display/RIFE/Stateful+components ... and if you don't want to store your RIFE flow state on the client- side, you can use other back-end stores, like sessions for instance: http://rifers.org/wiki/display/RIFE/Configurable+state+storage Hope this helps and if you find areas in the documentation that could use some improvement, please feel free to contribute. Take care, Geert On 20 Jun 2008, at 11:10, Rodrigue wrote: > > Hi Matthias, > > I have finally managed to do what I wanted to do, maybe not in the > best way though. > > You didn't have to explicitly worry about the IdentifiableUsersManager > interface because your custom manager implements RoleUsersManager, > which extends IdentifiableUsersManager. Still, you certainly had to > implement getLogin() and getAttributes(). I only implement > IdentifiableUsersManager because I don't need the role feature. > However, I have written a custom class that extends > RoleUsersAttributes so that the getAttributes() method on the > RoleUserIdentity returns my custom object in which I can store more > information than just login, password, and role. > > I read the user's guide section on managing user data ( > http://rifers.org/wiki/display/RIFE/GuideDatabaseUsers#GuideDatabaseUsers-sect1additionaldata > ) but wasn't sure how to link that to my custom credentials manager. > > Also, about your IDENTIFIED element, I don't think it is used at all > unless you have other elements that inherits from it, so I wasn't sure > either about how to use it. > > Anyway, my application works at the moment so I will keep going even > though I doubt I am really managing my user data the best way. Also, > some details of rife are still obscure to me. I am not sure how the > identity information is saved. I think it is sent to the client and I > don't know how to explicitly keep it on the server side (which, in my > understanding, would require defining a db table). > > All that is a bit of thinking aloud but maybe it can help somebody > who'll read it. In the meantime, I'll keep tinkering with rife until I > understand it more. At any rate, thanks for your help. > > Rodrigue > > On Jun 19, 11:09 am, Matthias Barmeier > <matthias.barme...@...> wrote: >> Hi Rodrigue, >> >> my Factory is really simple: >> >> package de.sourcepark.ms2.rife; >> >> import com.uwyn.rife.authentication.CredentialsManager; >> import >> com >> .uwyn >> .rife.authentication.credentialsmanagers.CredentialsManagerFactory; >> import com.uwyn.rife.ioc.HierarchicalProperties; >> import com.uwyn.rife.ioc.exceptions.PropertyValueException; >> >> No Id on have a Manager that implementes the interface you >> mentioned my >> decalaration is: >> >> public class MS2CredentialsManager implements CredentialsManager, >> RoleUsersManager >> >> What I have copied from some examples and not really understand is >> this >> main.xml element: >> >> <element id="IDENTIFIED" >> extends="rife/authenticated/identified.xml"> >> <property name="authElementId">AuthClient</property> >> <childtrigger name="authid"/> >> </element> >> >> May be this creates the things you need on the fly. >> >> Ciao >> Matthias >> >> Rodrigue wrote: >>> Hi Matthias, >> >>> thank you again for your reply. I still have some trouble though. >> >>> When I call >> >>> RoleUserIdentity identity = >>> (RoleUserIdentity >>> )getRequestAttribute(Identified.IDENTITY_ATTRIBUTE_NAME); >> >>> the identity is null. After looking at the rife source code I found >>> out that this is because my credentials manager does not implement >>> IdentifiableUsersManager. So I am now wondering what does your >>> de.sourcepark.ms2.rife.MS2CredentialsManagerFactory return in >>> getCredentialsManager? >>> Have you written your own CredentialsManager that also implements >>> IdentifiableUsersManager? >> >>> Rodrigue >> >>> On Jun 19, 9:57 am, Matthias Barmeier >>> <matthias.barme...@...> wrote: >> >>>> Hi Rodrigue, >> >>>> I use an entry element class as arrival: >> >>>> <arrival destid="EntryElement"/> >> >>>> The EntryElement is configured like: >> >>>> <element id="Entry" >>>> implementation="de.sourcepark.ms2.rife.EntryElement" >>>> inherits="AuthClient"> >>>> <outbean name="customer" prefix="pre_" >> >>>> classname="de.sourcepark.ms2.rife.customer.CBCustomerActiveEdit"/> >>>> <autolink srcexit="ClientCustomerEdit"/> >>>> <autolink srcexit="CustomerChangePw"/> >>>> </element> >> >>>> In the class I can call: >> >>>> RoleUserIdentity identity = >>>> (RoleUserIdentity >>>> )getRequestAttribute(Identified.IDENTITY_ATTRIBUTE_NAME); >> >>>> to get the identity object and then: >> >>>> identity.getLogin() >> >>>> To get the username. In the EntryElement you can set if you like a >>>> global var to reflect the logged in user and his role. >> >>>> Hope this helps. >> >>>> Ciao >>>> Matthias >> >>>> Rodrigue wrote: > > -- Geert Bevin Terracotta - http://www.terracotta.org Uwyn "Use what you need" - http://uwyn.com RIFE Java application framework - http://rifers.org Music and words - http://gbevin.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "rife-users" group. To post to this group, send email to rife-users@... To unsubscribe from this group, send email to rife-users-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rife-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: custom authentication and participantHi Geert, Thanks for your answer. I did read the authentication system internals, which was helpful in understanding how it works. As I said, I am now using a custom version of the identified mechanism. However I am getting confused once again. When you say "for that to work, you have to make sure that your authentication element executes before the rest" it seems to me that because all my elements inherit from the authentication element, the authentication always executes before the rest, does it not...? By inheriting from Auth, am I not insured that getRequestAttribute(Identified.IDENTITY_ATTRIBUTE_NAME) will return a non-null value? Also, the existing documentation is already quite substantial, so thanks to the work you and others have done. I'd be happy to try to extend it as soon as I have time, which means once my project in which I use rife is finished. Rodrigue On Jun 20, 4:22 pm, Geert Bevin <gbe...@...> wrote: > Hi Rodrigue, > > sorry that the documentation is a bit lacking in this regard. Have you > read through thishttp://rifers.org/wiki/display/RIFE/Authentication+system+internals > ? I think that you should be able to get a better idea of how the > authentication internals work. Also make sure to read the Javadoc of > the relevant interfaces/classes. > > As far as storing variables somewhere after the authentication > proceeds, this can be done in several ways. First, if you only want > this to be available to all the other elements in the same request, > it's best to use request attributes for this:http://rifers.org/docs/api/com/uwyn/rife/engine/ElementSupport.html#s...) > > This is what the identified element does. Of course, for that to work, > you have to make sure that your authentication element executes before > the rest, either by having it precede the others:http://rifers.org/wiki/display/RIFE/Precedence > > or by embedding it into your template and give it a high priority:http://rifers.org/wiki/display/RIFE/Embedded+element+priorities > > If you want to store these variables for a longer time, you can still > access the regular HTTP session within RIFE, you just have to turn on > raw access:http://rifers.org/docs/api/com/uwyn/rife/engine/ElementSupport.html#s...) > > After that you can use the unmanaged HTTP request and access the > session:http://rifers.org/docs/api/com/uwyn/rife/engine/ElementSupport.html#g...() > > Other ways of doing this is by creating stateful components:http://rifers.org/wiki/display/RIFE/Stateful+components > > ... and if you don't want to store your RIFE flow state on the client- > side, you can use other back-end stores, like sessions for instance:http://rifers.org/wiki/display/RIFE/Configurable+state+storage > > Hope this helps and if you find areas in the documentation that could > use some improvement, please feel free to contribute. > > Take care, > > Geert > > On 20 Jun 2008, at 11:10, Rodrigue wrote: > > > > > > > Hi Matthias, > > > I have finally managed to do what I wanted to do, maybe not in the > > best way though. > > > You didn't have to explicitly worry about the IdentifiableUsersManager > > interface because your custom manager implements RoleUsersManager, > > which extends IdentifiableUsersManager. Still, you certainly had to > > implement getLogin() and getAttributes(). I only implement > > IdentifiableUsersManager because I don't need the role feature. > > However, I have written a custom class that extends > > RoleUsersAttributes so that the getAttributes() method on the > > RoleUserIdentity returns my custom object in which I can store more > > information than just login, password, and role. > > > I read the user's guide section on managing user data ( > >http://rifers.org/wiki/display/RIFE/GuideDatabaseUsers#GuideDatabaseU... > > ) but wasn't sure how to link that to my custom credentials manager. > > > Also, about your IDENTIFIED element, I don't think it is used at all > > unless you have other elements that inherits from it, so I wasn't sure > > either about how to use it. > > > Anyway, my application works at the moment so I will keep going even > > though I doubt I am really managing my user data the best way. Also, > > some details of rife are still obscure to me. I am not sure how the > > identity information is saved. I think it is sent to the client and I > > don't know how to explicitly keep it on the server side (which, in my > > understanding, would require defining a db table). > > > All that is a bit of thinking aloud but maybe it can help somebody > > who'll read it. In the meantime, I'll keep tinkering with rife until I > > understand it more. At any rate, thanks for your help. > > > Rodrigue > > > On Jun 19, 11:09 am, Matthias Barmeier > > <matthias.barme...@...> wrote: > >> Hi Rodrigue, > > >> my Factory is really simple: > > >> package de.sourcepark.ms2.rife; > > >> import com.uwyn.rife.authentication.CredentialsManager; > >> import > >> com > >> .uwyn > >> .rife.authentication.credentialsmanagers.CredentialsManagerFactory; > >> import com.uwyn.rife.ioc.HierarchicalProperties; > >> import com.uwyn.rife.ioc.exceptions.PropertyValueException; > > >> No Id on have a Manager that implementes the interface you > >> mentioned my > >> decalaration is: > > >> public class MS2CredentialsManager implements CredentialsManager, > >> RoleUsersManager > > >> What I have copied from some examples and not really understand is > >> this > >> main.xml element: > > >> <element id="IDENTIFIED" > >> extends="rife/authenticated/identified.xml"> > >> <property name="authElementId">AuthClient</property> > >> <childtrigger name="authid"/> > >> </element> > > >> May be this creates the things you need on the fly. > > >> Ciao > >> Matthias > > >> Rodrigue wrote: > >>> Hi Matthias, > > >>> thank you again for your reply. I still have some trouble though. > > >>> When I call > > >>> RoleUserIdentity identity = > >>> (RoleUserIdentity > >>> )getRequestAttribute(Identified.IDENTITY_ATTRIBUTE_NAME); > > >>> the identity is null. After looking at the rife source code I found > >>> out that this is because my credentials manager does not implement > >>> IdentifiableUsersManager. So I am now wondering what does your > >>> de.sourcepark.ms2.rife.MS2CredentialsManagerFactory return in > >>> getCredentialsManager? > >>> Have you written your own CredentialsManager that also implements > >>> IdentifiableUsersManager? > > >>> Rodrigue > > >>> On Jun 19, 9:57 am, Matthias Barmeier > >>> <matthias.barme...@...> wrote: > > >>>> Hi Rodrigue, > > >>>> I use an entry element class as arrival: > > >>>> <arrival destid="EntryElement"/> > > >>>> The EntryElement is configured like: > > >>>> <element id="Entry" > >>>> implementation="de.sourcepark.ms2.rife.EntryElement" > >>>> inherits="AuthClient"> > >>>> <outbean name="customer" prefix="pre_" > > >>>> classname="de.sourcepark.ms2.rife.customer.CBCustomerActiveEdit"/> > >>>> <autolink srcexit="ClientCustomerEdit"/> > >>>> <autolink srcexit="CustomerChangePw"/> > >>>> </element> > > >>>> In the class I can call: > > >>>> RoleUserIdentity identity = > >>>> (RoleUserIdentity > >>>> )getRequestAttribute(Identified.IDENTITY_ATTRIBUTE_NAME); > > >>>> to get the identity object and then: > > >>>> identity.getLogin() > > >>>> To get the username. In the EntryElement you can set if you like a > >>>> global var to reflect the logged in user and his role. > > >>>> Hope this helps. > > >>>> Ciao > >>>> Matthias > > >>>> Rodrigue wrote: > > -- > Geert Bevin > Terracotta -http://www.terracotta.org > Uwyn "Use what you need" -http://uwyn.com > RIFE Java application framework -http://rifers.org > Music and words -http://gbevin.com You received this message because you are subscribed to the Google Groups "rife-users" group. To post to this group, send email to rife-users@... To unsubscribe from this group, send email to rife-users-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rife-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: custom authentication and participantHi Rodrigue, > > As I said, I am now using a custom version of the identified > mechanism. However I am getting confused once again. When you say > "for that to work, you have to make sure that your authentication > element executes before the rest" > it seems to me that because all my elements inherit from the > authentication element, the authentication always executes before the > rest, does it not...? You're correct. The last applications I developed with RIFE did not use inheritance for authentication, but rather an embedded element as a login box which then stored the credentials in the request as attributes, leaving the site accessible but to guests and authorized people. > By inheriting from Auth, am I not insured that > getRequestAttribute(Identified.IDENTITY_ATTRIBUTE_NAME) will return a > non-null value? Yes, you are. > Also, the existing documentation is already quite substantial, so > thanks to the work you and others have done. I'd be happy to try to > extend it as soon as I have time, which means once my project in which > I use rife is finished. Cool, every bit of help is much appreciated. Take care, geert -- Geert Bevin Terracotta - http://www.terracotta.org Uwyn "Use what you need" - http://uwyn.com RIFE Java application framework - http://rifers.org Music and words - http://gbevin.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "rife-users" group. To post to this group, send email to rife-users@... To unsubscribe from this group, send email to rife-users-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rife-users?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free embeddable forum powered by Nabble | Forum Help |
