Changeset 5974


Ignore:
Timestamp:
02/12/15 14:53:18 (9 years ago)
Author:
Twan Goosen
Message:

also report as unauthenticated when current user is 'anonymous' (in case of shib)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/branches/ComponentRegistry-2.0/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/AuthenticationRestService.java

    r5973 r5974  
    22
    33import clarin.cmdi.componentregistry.AuthenticationRequiredException;
    4 import clarin.cmdi.componentregistry.Configuration;
     4import clarin.cmdi.componentregistry.ComponentRegistryFactory;
    55import clarin.cmdi.componentregistry.UserCredentials;
    66import clarin.cmdi.componentregistry.impl.database.ValidationException;
     
    3838
    3939    private final Logger logger = LoggerFactory.getLogger(AuthenticationRestService.class);
    40    
     40
    4141    @Context
    4242    private SecurityContext security;
    4343    @Context
    4444    private UriInfo uriInfo;
    45    
     45
    4646    @GET
    4747    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
     
    5050        final Principal userPrincipal = security.getUserPrincipal();
    5151
    52         if (userPrincipal == null) {
     52        if (userPrincipal == null || ComponentRegistryFactory.ANONYMOUS_USER.equals(userPrincipal.getName())) {
    5353            return new AuthenticationInfo(false);
    5454        } else {
     
    6565    public Response triggerAuthenticationRequest() {
    6666        logger.debug("Client has triggered authentication request");
    67        
     67
    6868        //done - redirect to front end
    6969        final URI frontEndUri = uriInfo.getBaseUri().resolve("..");
Note: See TracChangeset for help on using the changeset viewer.