-
Jul 28th, 2011, 08:40 AM
#1
How to retrieve userid having colon in spring security
I have a user id = "tel:123" and password="code", and when i retrieve the user id from authentication object i get only "tel" as user id and password as "123:code".
It seems spring security uses ":" as delimiter to separate user id and password.
So could you please help me out how I can retrieve the user id correctly with colon.
Comments are highly appreciated.
-
Jul 28th, 2011, 04:51 PM
#2
No, the username and password are not stored in the same field or delimited by a colon. How is the Authentication object being created - what are you authenticating against?
-
Jul 29th, 2011, 01:03 AM
#3
Thanks Luke for the response,
I am using customized authentication provider class which implements "AuthenticationProvider" interface.
And implementing the method :
# public Authentication authenticate(Authentication authentication) throws AuthenticationException {
I am just getting the values from the authentication object, which is being set by the framework.
I get user id and password as given:
# Object obj = authentication.getPrincipal();
# if (obj instanceof UserDetails) {
# username = ((UserDetails) obj).getUsername();
# password = ((UserDetails) obj).getPassword();
# } else {
# username = obj.toString();
# password = obj.toString();
# }
Last edited by rc123; Jul 29th, 2011 at 02:25 AM.
-
Aug 2nd, 2011, 01:50 AM
#4
Hi Luke I have provided the details and am using basic authentication.
So what i guess is basic authentication scheme uses a colon as a separator between username and password.
From the header i got this: Authorization: Basic dGVsOjEyMzpQYXNzd29yZDEh
This is a Base64 encoded value and it uses delimiter to separate username and password.
When base64 decoded ,looks like
Authorization: tel : 123:Password
Could you please give some inputs.
Thanks
Last edited by rc123; Aug 2nd, 2011 at 02:00 AM.
-
Aug 2nd, 2011, 01:56 PM
#5
The user ID isn't allowed to contain a colon if you are using Basic authentication. Check the RFC (page 5).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules