stormpath / stormpath-sdk-java

Official Java SDK for the Stormpath User Management REST API
222 stars 155 forks source link

thymeleaf-extras-stormpath #417

Open claytantor opened 8 years ago

claytantor commented 8 years ago

A nice to have would be a thymleaf dialect that would map the stormpath groups to spring security roles that behaved like https://github.com/thymeleaf/thymeleaf-extras-springsecurity. Currently when I use the thymeleaf extras for spring security the roles map to the REST url for the stormpath group... ie.

the template html:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>User Home</title>
</head>
<body>
<h1><span th:text="${username}">User</span> Home</h1>

<div th:text="${#authentication.name}">
    The value of the "name" property of the authentication object should appear here.
</div>

<div th:if="${#authorization.expression('hasRole(''basic-users'')')}">
    This will only be displayed if authenticated user has role basic-users.
</div>

<h2>authorities</h2>
<div th:text="${#authentication.authorities}">
    This will show authorities
</div>
<!--Roles: <span sec:authentication="principal.authorities">[ROLE_USER, ROLE_ADMIN]</span>-->

</body>
</html>

produces

claytantor@foobar.com Home

claytantor@foobar.com

authorities

[https://api.stormpath.io/v1/groups/10QTexampleKzQvyO]

should be:

claytantor@foobar.com Home

claytantor@foobar.com

authorities

[ROLE_USERS]

lhazlewood commented 8 years ago

cc @mrioan and @dogeared - thoughts?

dogeared commented 8 years ago

Hey @claytantor - Once again, apologies for very delayed response on Github. We are tracking this issue from our friendly contributor @george-hawkins-aa in #325.

We will be able to support using roles or authorities in our templates for the 1.0 release and are investigating the best approach to resolving it.

I'll keep this issue open and add it in to the 1.0 milestone to track it.

As I mentioned before, we are working to improve our process to track and respond to github issues posted from the community. Thanks again and keep 'em coming!

-Micah

claytantor commented 8 years ago

Cool. Thanks. I hope this was helpful.