package com.google.rolecall.authentication;

import com.google.rolecall.Constants;
import javax.servlet.http.HttpServletRequest;
import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;

/** Parses the header of a request for EMAIL and AUTHORIZZATION used in authentication */
public class PreAuthTokenHeaderFilter extends AbstractPreAuthenticatedProcessingFilter {

  @Override
  protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
    return request.getHeader(Constants.Headers.EMAIL);
  }

  @Override
  protected Object getPreAuthenticatedCredentials(HttpServletRequest request) {
    String token = request.getHeader(Constants.Headers.OAUTH_KEY);
    return token == null ? "" : token;
  }
}

@@ -661,21 +661,25 @@
  String 
-token
+fullValue
  = reque
@@ -729,41 +729,167 @@
     
-return token == null ? %22%22 : token
+String prefix = %22Bearer %22;%0A%0A    if(fullValue != null && fullValue.startsWith(prefix)) %7B%0A      return fullValue.substring(prefix.length());%0A    %7D%0A%0A    return %22%22
 ;%0A  

Add bearer tag to auth