[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-286) SeamTest - Add support for authenticated user
Bradley Smith (JIRA)
jira-events at jboss.com
Wed Nov 8 09:19:41 EST 2006
[ http://jira.jboss.com/jira/browse/JBSEAM-286?page=all ]
Bradley Smith updated JBSEAM-286:
---------------------------------
Attachment: MockHttpServletRequest.java
Here is the modified MockHttpServletRequest (again - no code reformatting). Diff is below.
=========================================================================
bash-2.05b$ diff MockHttpServletRequest-orig.java MockHttpServletRequest.java
12a13
> import java.security.acl.Group;
23a25
> import org.jboss.security.SimplePrincipal;
37c39,43
<
---
> // security properties
> private Principal principal;
> private Group roles;
> private boolean grantAllRoles;
>
39a46,60
> this(session,null,null,true);
> }
>
> public MockHttpServletRequest(HttpSession session, Principal principal)
> {
> this(session,principal,null,true /* grant all roles */);
> }
>
> public MockHttpServletRequest(HttpSession session, Principal principal, Group roles)
> {
> this(session,principal,roles,false);
> }
>
> public MockHttpServletRequest(HttpSession session, Principal principal, Group roles, boolean grantAllRoles)
> {
40a62,64
> this.principal = principal;
> this.roles = roles;
> this.grantAllRoles = grantAllRoles;
123,124c147
< //TODO
< return null;
---
> return this.principal == null ? null : this.principal.getName();
127c150
< public boolean isUserInRole(String arg0)
---
> public boolean isUserInRole(String role)
129c152,155
< return true;
---
> if (roles != null) {
> return this.roles.isMember(new SimplePrincipal(role));
> }
> return this.grantAllRoles ? true : false;
134,135c160
< //TODO
< return null;
---
> return this.principal;
> SeamTest - Add support for authenticated user
> ---------------------------------------------
>
> Key: JBSEAM-286
> URL: http://jira.jboss.com/jira/browse/JBSEAM-286
> Project: JBoss Seam
> Issue Type: Feature Request
> Components: Core
> Affects Versions: 1.0.1
> Environment: All
> Reporter: Bradley Smith
> Assigned To: Gavin King
> Fix For: 1.1.0.CR1
>
> Attachments: MockExternalContext.java, MockExternalContext.java, MockHttpServletRequest.java, MockHttpServletRequest.java, SeamTest.java, SeamTest.java
>
>
> Add a property of type Principal and another property (maybe of type Group []?) to Script. The Principal should be used by the MockHttpServletRequest to represent and authenticated user. The Group [] property should be used by the MockHttpServletRequest to support the isUserInRole() implementation.
> These properties ideally should be settable by overriding the setup() method of Script.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list