You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by "andr3aLucch3si85 (via GitHub)" <gi...@apache.org> on 2025/03/22 08:10:42 UTC

[I] SecurityTagLib not working because SCH.getContext().getAuthentication() is null [grails-spring-security]

andr3aLucch3si85 opened a new issue, #1104:
URL: https://github.com/apache/grails-spring-security/issues/1104

   ### Expected Behavior
   
   Using grails 7.0.0-M3 with spring-secutiry-core plugin 7.0.0-M3 after login TagLib function <sec:loggedInUserInfo field="username"/> should return username of the user.
   
   ### Actual Behaviour
   
   loggedInUserInfo doesn't return info because SCH.context.authentication is null
   
   ![Image](https://github.com/user-attachments/assets/78946be4-0ad5-4a0e-8912-1c3efce0a4b0)
   
   ### Steps To Reproduce
   
   _No response_
   
   ### Environment Information
   
   Java version: 17
   
   ### Example Application
   
   _No response_
   
   ### Version
   
   7.0.0-M3


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@grails.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] SecurityTagLib not working because SCH.getContext().getAuthentication() is null [grails-spring-security]

Posted by "andr3aLucch3si85 (via GitHub)" <gi...@apache.org>.
andr3aLucch3si85 commented on issue #1104:
URL: https://github.com/apache/grails-spring-security/issues/1104#issuecomment-2748011278

   In logged.gsp layout <sec:loggedInUserInfo field="username"/> doesn't work. On frontend I can't see the username but only "Ciao !"


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] SecurityTagLib not working because SCH.getContext().getAuthentication() is null [grails-spring-security]

Posted by "matrei (via GitHub)" <gi...@apache.org>.
matrei commented on issue #1104:
URL: https://github.com/apache/grails-spring-security/issues/1104#issuecomment-2748025259

   Thank you!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] SecurityTagLib not working because SCH.getContext().getAuthentication() is null [grails-spring-security]

Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on issue #1104:
URL: https://github.com/apache/grails-spring-security/issues/1104#issuecomment-2746336717

   Without an example application to reproduce, we cannot help
   you further.  The functional test application is working so it must be related to a configuration difference or a nonstandard configuration for newer versions of Spring Security.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] `` tag is not working in GSP layouts [grails-spring-security]

Posted by "mobilemindtec (via GitHub)" <gi...@apache.org>.
mobilemindtec commented on issue #1104:
URL: https://github.com/apache/grails-spring-security/issues/1104#issuecomment-3192545939

   How will this look with the release of grails 7?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] SecurityTagLib not working because SCH.getContext().getAuthentication() is null [grails-spring-security]

Posted by "matrei (via GitHub)" <gi...@apache.org>.
matrei commented on issue #1104:
URL: https://github.com/apache/grails-spring-security/issues/1104#issuecomment-2747996684

   @andr3aLucch3si85 In your test app, I can reproduce that `<sec:loggedInUserInfo field="username"/>` works in a GSP page but not in a GSP layout. Does this accurately describe the issue you're experiencing?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] SecurityTagLib not working because SCH.getContext().getAuthentication() is null [grails-spring-security]

Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on issue #1104:
URL: https://github.com/apache/grails-spring-security/issues/1104#issuecomment-2746288946

   I'm unable to reproduce this.  I used the `plugin-core/examples/functional-test-app` that's in the repository:
   1. call `testData/addTestUsers` URL to add users
   2. use the default admin / password to login to `indexAnnotated`
   3. place debug point in the `index` action, and `SecurityContextHolder.context.authentication` is defined.
   
   Can you please provide an example application?  The filter order has changed in later versions of Spring Security.  If you were using a custom filter order it could explain this problem.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] SecurityTagLib not working because SCH.getContext().getAuthentication() is null [grails-spring-security]

Posted by "andr3aLucch3si85 (via GitHub)" <gi...@apache.org>.
andr3aLucch3si85 commented on issue #1104:
URL: https://github.com/apache/grails-spring-security/issues/1104#issuecomment-2746333484

   Sorry but I can't share code.. The login process ends with success. After that I have a simple view that must display the username and some parts based on user's role.
   For example:
   
   ![Image](https://github.com/user-attachments/assets/49a54369-4667-40a2-9874-f4711267ca05)
   
   loggedUserInfo is called
   
   ![Image](https://github.com/user-attachments/assets/93f31a7d-94a9-4fc6-ba0f-d2810daa272c)
   
   At line 113 isLoggedIn returns false. The implementation of isLoggedIn is in my first post and the problem is that authentication is null.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] `` tag is not working in GSP layouts [grails-spring-security]

Posted by "jamesfredley (via GitHub)" <gi...@apache.org>.
jamesfredley closed issue #1104: `<sec:loggedInUserInfo>` tag is not working in GSP layouts
URL: https://github.com/apache/grails-spring-security/issues/1104


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] SecurityTagLib not working because SCH.getContext().getAuthentication() is null [grails-spring-security]

Posted by "andr3aLucch3si85 (via GitHub)" <gi...@apache.org>.
andr3aLucch3si85 commented on issue #1104:
URL: https://github.com/apache/grails-spring-security/issues/1104#issuecomment-2748057199

   I have probably found a workaround. I have included logged.gsp using g:render tag and it works! 
   
   ![Image](https://github.com/user-attachments/assets/ef791082-8607-41c3-86df-e5160fdd54a6)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] SecurityTagLib not working because SCH.getContext().getAuthentication() is null [grails-spring-security]

Posted by "andr3aLucch3si85 (via GitHub)" <gi...@apache.org>.
andr3aLucch3si85 commented on issue #1104:
URL: https://github.com/apache/grails-spring-security/issues/1104#issuecomment-2747725345

   [test-login.zip](https://github.com/user-attachments/files/19428279/test-login.zip)
   
   I've done a basic project. To reproduce bug:
   1. Start program
   2. Login with admin admin (sometimes it requires login again)
   
   Dashboard.gsp include logged.gsp in head. logged.gsp calls <sec:loggedInUserInfo field="username"/> but springSecurityService.isLoggedIn() returns false.
   
   Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] `` tag is not working in GSP layouts [grails-spring-security]

Posted by "andr3aLucch3si85 (via GitHub)" <gi...@apache.org>.
andr3aLucch3si85 commented on issue #1104:
URL: https://github.com/apache/grails-spring-security/issues/1104#issuecomment-2748323083

   No... That is not a valid solution!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] `` tag is not working in GSP layouts [grails-spring-security]

Posted by "jamesfredley (via GitHub)" <gi...@apache.org>.
jamesfredley commented on issue #1104:
URL: https://github.com/apache/grails-spring-security/issues/1104#issuecomment-3192733659

   Please retest `<sec:loggedInUserInfo field="username"/>` with 7.0.0-RC1 or 7.0.0-SNAPSHOT now that the default is back to sitemesh 2.  It should work the same as it has in the past now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] `` tag is not working in GSP layouts [grails-spring-security]

Posted by "mobilemindtec (via GitHub)" <gi...@apache.org>.
mobilemindtec commented on issue #1104:
URL: https://github.com/apache/grails-spring-security/issues/1104#issuecomment-3192836399

   It works again in this version!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org