Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow people to retrieve token via basic auth popup.

  • Loading branch information...
commit 480d74ddc2553861f825a4857abb5bbf187a4d7d 1 parent 1f95922
@shsu authored
View
4 src/main/java/ca/bcit/infosys/comp4911/services/UserResource.java
@@ -75,7 +75,7 @@ public Response updateUserProfile(
public Response retrieveToken(
@HeaderParam(SH.AUTHORIZATION_STRING) final String headerAuth) {
if (Strings.isNullOrEmpty(headerAuth)) {
- throw new WebApplicationException(Response.Status.UNAUTHORIZED);
+ throw new WebApplicationException(Response.status(401).header("WWW-Authenticate","Basic realm=\"comp4911\"").build());
}
String decodedCredentials = new String(
@@ -88,7 +88,7 @@ public Response retrieveToken(
for (String credential : credentials) {
if (Strings.isNullOrEmpty(credential)) {
- throw new WebApplicationException(SH.response(400));
+ throw new WebApplicationException(Response.Status.BAD_REQUEST);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.