Skip to content

Commit

Permalink
Reflect passkey server updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Kieun committed Dec 18, 2023
1 parent c184126 commit 6def62e
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dependencies {
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'org.mapstruct:mapstruct:1.5.5.Final'
implementation files('libs/server-dto-1.5.0.jar')
implementation files('libs/server-dto-1.8.4.jar')
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
annotationProcessor 'org.projectlombok:lombok'
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@

@Mapper(componentModel = "spring")
public interface AssertionOptionsServerRequestMapper {
@Mapping(target = "attestation", ignore = true)
@Mapping(target = "hints", ignore = true)
@Mapping(target = "userId", source = "username")
@Mapping(target = "timeout", constant = "300000L")
AuthenticationOptionsServerRequestDto toWebauthnServerDto(AssertionOptionsServerRequest rpServer);

@Mapping(target = "attestation", ignore = true)
@Mapping(target = "userId", source = "username")
AuthenticationOptionsServerRequestDto toWebauthnServerDtoLv3(AssertionOptionsServerRequestLv3 rpServer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
ServerAuthenticatorSelectionCriteriaMapper.class
})
public interface AttestationOptionsServerRequestMapper {
@Mapping(target = "hints", ignore = true)
@Mapping(target = "user", source = "rpServer")
@Mapping(target = "excludeCredentials", constant = "true")
@Mapping(target = "timeout", constant = "300000L")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (C) 2023 SK TELECOM CO., LTD.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.sktelecom.authentication.passkey.passkeyrpsample.model;

import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Collections;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
public enum ServerPublicKeyCredentialHints {
SECURITY_KEY("security-key"),
CLIENT_DEVICE("client-device"),
HYBRID("hybrid");

@Getter
@JsonValue
private final String value;

private static final Map<String, ServerPublicKeyCredentialHints> MAP_BY_VALUE =
Collections.unmodifiableMap(Stream.of(values())
.collect(Collectors.toMap(ServerPublicKeyCredentialHints::getValue, Function.identity())));

public static ServerPublicKeyCredentialHints find(String value) {
return Optional.ofNullable(MAP_BY_VALUE.get(value)).orElseThrow(NoSuchElementException::new);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@
package com.sktelecom.authentication.passkey.passkeyrpsample.model.transport.lv3;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.sktelecom.authentication.passkey.passkeyrpsample.model.ServerPublicKeyCredentialHints;
import com.sktelecom.authentication.passkey.passkeyrpsample.model.ServerUserVerificationRequirement;
import java.util.List;
import lombok.Data;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class AssertionOptionsServerRequestLv3 {
private String username;
private ServerUserVerificationRequirement userVerification;
private final List<ServerPublicKeyCredentialHints> hints;
Long timeout;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.sktelecom.authentication.passkey.passkeyrpsample.model.ServerAttestationConveyancePreference;
import com.sktelecom.authentication.passkey.passkeyrpsample.model.ServerAuthenticatorSelectionCriteria;
import com.sktelecom.authentication.passkey.passkeyrpsample.model.ServerPublicKeyCredentialHints;
import java.util.List;
import javax.validation.constraints.NotBlank;
import lombok.Data;

Expand All @@ -31,6 +33,7 @@ public class AttestationOptionsServerRequestLv3 {
private String displayName;
private ServerAuthenticatorSelectionCriteria authenticatorSelection;
private ServerAttestationConveyancePreference attestation;
private List<ServerPublicKeyCredentialHints> hints;
Boolean excludeCredentials;
Long timeout;
}

0 comments on commit 6def62e

Please sign in to comment.