• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring security - Mysql - problem

 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys,
I am having problem with change ROLE_ prefix. I have BD mysql with some function like: Manager, Vendor etc. So, i would like to use on my


this way:



how can i do it?

anyone could i help me, please?

this my code:


thanks!
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have bad news. You can't

For some reason your Roles in Spring Security must be prefixed with "ROLE_"

I figured this out tearing my hair out for hours a year ago.

So in your query to load the data just prepend the "ROLE_"

like

SELECT username, 'ROLE_' || real_role_field FROM myRoleTable where username = ?

Mark
 
camilo lopes
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mark,

ohh my god, bad news. I spent my all day with this and i did not find any solution. i do not get understand why required we have ROLE_ like prefix, legacy app does not record on BD ROLE_ADMIN.

Now i have this code:



So, if i use your sugesst i will get to fix?




thanks for your help...
 
camilo lopes
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mark,

I got to fix, look:
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cool, I didn't know about the concat function in MySql, the sql I wrote works in Oracle, so assumed it would work elsewhere.

Congrats on getting it to work.

Mark
 
camilo lopes
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi mark,

Yes, looks good with concat function. I have not tested in other BD. but it seems to work ok.

thanks for your help
 
reply
    Bookmark Topic Watch Topic
  • New Topic