Mike
Mike

Reputation: 801

The difference : 'sec:authentication' & 'sec:authentication property'

I have included <span sec:authentication="name"></span> in my html page to display the username in my page.

I also find <span sec:authentication property="principal.username"></span> to display the same.

All I need is to know is that, is there a difference in the way on how the username is picked from LDAP/DB between these methods? Which method could hold the best response time?

Upvotes: 0

Views: 1478

Answers (1)

holmis83
holmis83

Reputation: 16604

On typical configurations, i.e. when UserDetails interface is used, they are the same.

  • The name always returns the username on all systems. For configurations with UserDetails, it actually translates to principal.username.

  • The principal.username picks the username from the principal object, which is typically a UserDetails instance. This property is not guaranteed to exist with all configurations.

Both should be very quick to invoke.

Upvotes: 2

Related Questions