[DS-309] Shiboleth default roles are applied also to anonymous user and user logged-in with other methods

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@4308 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Andrea Bollini
2009-09-30 19:01:21 +00:00
parent 40559cdfd1
commit 316408bb47
3 changed files with 26 additions and 17 deletions

View File

@@ -160,26 +160,26 @@ public interface AuthenticationMethod {
public boolean isImplicit();
/**
* Get list of extra groups that user implicitly belongs to.
* Returns IDs of any EPerson-groups that the user authenticated by
* this request is <em>implicitly</em> a member of -- e.g.
* a group that depends on the client network-address.
* Get list of extra groups that user implicitly belongs to. Note that this
* method will be invoked regardless of the authentication status of the
* user (logged-in or not) e.g. a group that depends on the client
* network-address.
* <p>
* It might make sense to implement this method by itself in a separate
* authentication method that just adds special groups, if the
* code doesn't belong with any existing auth method.
* The stackable authentication system was designed expressly to
* separate functions into "stacked" methods to keep your
* site-specific code modular and tidy.
*
* authentication method that just adds special groups, if the code doesn't
* belong with any existing auth method. The stackable authentication system
* was designed expressly to separate functions into "stacked" methods to
* keep your site-specific code modular and tidy.
*
* @param context
* A valid DSpace context.
*
* A valid DSpace context.
*
* @param request
* The request that started this operation, or null if not applicable.
*
* @return array of EPerson-group IDs, possibly 0-length, but
* never <code>null</code>.
* The request that started this operation, or null if not
* applicable.
*
* @return array of EPerson-group IDs, possibly 0-length, but never
* <code>null</code>.
*/
public int[] getSpecialGroups(Context context, HttpServletRequest request)
throws SQLException;

View File

@@ -203,6 +203,8 @@ public class ShibAuthentication implements AuthenticationMethod
{
// the person exists, just return ok
context.setCurrentUser(eperson);
request.getSession().setAttribute("shib.authenticated",
new Boolean("true"));
}
return AuthenticationMethod.SUCCESS;
@@ -215,7 +217,13 @@ public class ShibAuthentication implements AuthenticationMethod
*/
public int[] getSpecialGroups(Context context, HttpServletRequest request)
{
// no user logged in or user not logged from shibboleth
if (context.getCurrentUser() == null
|| request.getSession().getAttribute("shib.authenticated") == null)
{
return new int[0];
}
if (request.getSession().getAttribute("shib.specialgroup") != null)
{
return (int[]) request.getSession().getAttribute(

View File

@@ -78,6 +78,7 @@
- [DS-261] Community Admin JSPUI: porting of the DS-228 patch
- [DS-271] Make the OAI DC crosswalk configurable
- [DS-260] Template item some times has owningCollection filled and some times not
- [DS-309] Shiboleth default roles are applied also to anonymous user and user logged-in with other methods
(Tim Donohue)
- [DS-218] Cannot add/remove email subscriptions from Profile page in XMLUI