It's all sample code for typical use cases. For authentication, you need to have (or Shiro needs to have) an AuthenticationInfo in session. That's where the principals and the credentials tokens are stored. Separately, in your Tapestry application, you may have several (preferably light) session objects for a user who may or may not have been authenticated, such as a shopping cart or a simple user object caching the most important user attributes as a performance optimization (in a database backed environment). In the case of this sample, you want to create or update this user object from data obtained by the remote authentication provider.
Kalle On Tue, Aug 19, 2014 at 7:38 PM, George Christman <gchrist...@cardaddy.com> wrote: > I think where I was confused was coming at this with the idea of having a > database backed environment. I see your comments in CurrentUser.class > about ApplicationStateCreator > although I still don't fully understand it. I also seen some code where you > were commenting out > SimpleAuthenticationInfo where it takes currentUser. With that being > commented out, I'm just not sure I understand how currentUser and the merge > are getting used. > > > On Tue, Aug 19, 2014 at 7:48 PM, Kalle Korhonen < > kalle.o.korho...@gmail.com> > wrote: > > > The examples lack comments because I strongly believe in self-documenting > > code. FederatedAccountService.federate() is the core concept of the > > federated account module. Federated accounts module allows you to > federate > > (i.e. join, merge) separate accounts together. The implementation of this > > CurrentUser is with the example code and a sample implementation for > restfb > > remote account is: > > public void merge(com.restfb.types.User user) { > > username = user.getName(); > > firstName = user.getFirstName(); > > lastName = user.getLastName(); > > } > > > > Any code example requires you to read the code but I'm not sure how I > could > > change the code to highlight the possibilities better. Obviously, what's > > clear to me may not be so for others, so any suggestions for improvements > > are welcome. > > > > Kalle > > > > > > > > On Tue, Aug 19, 2014 at 2:32 PM, Chris Mylonas <ch...@opencsta.org> > wrote: > > > > > CurrentUser.class > > > > > > Its a get method, probably on a hashtable-like object. Getting current > > > user. > > > > > > The auth token is probably from the oauth2 provider like fb or gg. > > > > > > With the current user and this token, merge them in *your* app. > > > > > > /guessing > > > On 20/08/2014 7:05 am, "George Christman" <gchrist...@cardaddy.com> > > wrote: > > > > > > > I guess I'm not following the logic of the code then. Why would they > be > > > > passing CurrentUser into it then? > > > > On Aug 19, 2014 4:46 PM, "Lance Java" <lance.j...@googlemail.com> > > wrote: > > > > > > > > > The ApplicationStateManager is a core Tapestry service and is an > > > > > abstraction over HttpSession persistence. As stated in the javadocs > > > > > Application state is probably a bad choice of naming. In hindsight > it > > > > > should probably be called SessionStateManager. > > > > > On 19 Aug 2014 21:04, "George Christman" <gchrist...@cardaddy.com > > > > > > wrote: > > > > > > > > > > > Hi guys, I see this example of ApplicationStateManager being used > > > with > > > > > the > > > > > > federatedaccounts example. line 20 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > https://github.com/tynamo/tynamo-example-federatedaccounts/blob/master/src/main/java/org/tynamo/examples/federatedaccounts/services/FederatedAccountServiceExample.java > > > > > > > > > > > > I've never seen it used before, so I was hoping someone could > > provide > > > > > some > > > > > > insight on what this code is actually doing and what the purpose > of > > > > using > > > > > > ApplicationStateManager is. > > > > > > > > > > > > Thanks, > > > > > > > > > > > > > > > > > > -- > > > > > > George Christman > > > > > > www.CarDaddy.com > > > > > > P.O. Box 735 > > > > > > Johnstown, New York > > > > > > > > > > > > > > > > > > > > > > > > -- > George Christman > www.CarDaddy.com > P.O. Box 735 > Johnstown, New York >