@Override
		public UserDetails getValue(HttpContext context) {
			
			UserDetails userDetails = null;
			
			Authentication auth = SecurityContextHolder.getContext().getAuthentication();
			
			if (!(auth instanceof AnonymousAuthenticationToken)) {
			    
				userDetails =
						 (UserDetails)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
			}

			if (userDetails == null && authenticationRequired){

                throw new WebApplicationException(
                        Response
                                .status(Response.Status.UNAUTHORIZED)
                                .entity("Unauthorized")
                                .header("WWW-Authenticate", "Basic realm='innovationgateway.us'")
                                .type(MediaType.TEXT_PLAIN)
                                .build()
                );
			} 
			
			if (userDetails == null ) {
					
				userDetails = new AnonymousUserDetails();
			}
			
			return userDetails;
		}