Add tests for generating profile key credentials

This commit is contained in:
Jon Chambers
2021-11-18 11:02:47 -05:00
committed by Jon Chambers
parent 68412b3901
commit 20a71b7df2
3 changed files with 170 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ import javax.validation.valueextraction.Unwrapping;
import javax.ws.rs.BadRequestException;
import javax.ws.rs.Consumes;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.ForbiddenException;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.PUT;
@@ -287,6 +288,10 @@ public class ProfileController {
if (credentialRequest.isPresent() && credentialType.isPresent() && profile.isPresent() && requestAccount.isPresent()) {
if (PNI_CREDENTIAL_TYPE.equals(credentialType.get())) {
if (!isSelf) {
throw new ForbiddenException();
}
profileKeyCredentialResponse = null;
pniCredentialResponse = getPniCredential(credentialRequest.get(),
profile.get(),

View File

@@ -140,4 +140,12 @@ public class Profile {
public List<Badge> getBadges() {
return badges;
}
public ProfileKeyCredentialResponse getCredential() {
return credential;
}
public PniCredentialResponse getPniCredential() {
return pniCredential;
}
}