Give 'unauthorized' and 'missing' better names

This commit is contained in:
Michael Walker 2018-02-07 09:39:35 +00:00
parent 44d3ddd9aa
commit f13324134f

View file

@ -78,7 +78,7 @@ public class Oauth2Filter implements Filter {
); );
return; return;
} catch (MissingRepositoryException e) { } catch (MissingRepositoryException e) {
missing(project, e, (HttpServletResponse) servletResponse); handleMissingRepository(project, e, (HttpServletResponse) servletResponse);
} }
Log.info("[{}] Auth not needed", project); Log.info("[{}] Auth not needed", project);
filterChain.doFilter(servletRequest, servletResponse); filterChain.doFilter(servletRequest, servletResponse);
@ -133,7 +133,7 @@ public class Oauth2Filter implements Filter {
) )
).execute().getAccessToken(); ).execute().getAccessToken();
} catch (TokenResponseException e) { } catch (TokenResponseException e) {
unauthorized(projectName, capturedUsername, e.getStatusCode(), request, response); handleNeedAuthorization(projectName, capturedUsername, e.getStatusCode(), request, response);
return; return;
} }
final Credential cred = new Credential.Builder( final Credential cred = new Credential.Builder(
@ -148,7 +148,7 @@ public class Oauth2Filter implements Filter {
servletResponse servletResponse
); );
} else { } else {
unauthorized(projectName, capturedUsername, 0, request, response); handleNeedAuthorization(projectName, capturedUsername, 0, request, response);
} }
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
throw new Error("Couldn't retrieve authentication", e); throw new Error("Couldn't retrieve authentication", e);
@ -156,14 +156,14 @@ public class Oauth2Filter implements Filter {
} }
} }
} else { } else {
unauthorized(projectName, capturedUsername, 0, request, response); handleNeedAuthorization(projectName, capturedUsername, 0, request, response);
} }
} }
@Override @Override
public void destroy() {} public void destroy() {}
private void unauthorized( private void handleNeedAuthorization(
String projectName, String projectName,
String userName, String userName,
int statusCode, int statusCode,
@ -203,7 +203,7 @@ public class Oauth2Filter implements Filter {
w.close(); w.close();
} }
private void missing( private void handleMissingRepository(
String projectName, String projectName,
MissingRepositoryException e, MissingRepositoryException e,
HttpServletResponse response HttpServletResponse response