Skip to content

Commit b5dad12

Browse files
authored
Merge pull request #326 from webauthn4j/correct-errors
Correct errors
2 parents 4617013 + cc41f33 commit b5dad12

File tree

10 files changed

+20
-277
lines changed

10 files changed

+20
-277
lines changed

build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
buildscript {
1818
def springBootVersion = '2.3.0.RELEASE'
19-
def sonarqubeVersion = "2.8.0.1969"
20-
def asciidoctorGradleVersion="1.6.1"
21-
def artifactoryVersion="4.15.2"
22-
def bintrayVersion = "1.8.5"
23-
def owaspDependencyCheckVersion = "5.3.2.1"
24-
def httpBuilderVersion = "0.7.2"
19+
def sonarqubeVersion = '2.8.0.1969'
20+
def asciidoctorGradleVersion='1.6.1'
21+
def artifactoryVersion='4.15.2'
22+
def bintrayVersion = '1.8.5'
23+
def owaspDependencyCheckVersion = '5.3.2.1'
24+
def httpBuilderVersion = '0.7.2'
2525

2626
repositories {
2727
mavenCentral()
@@ -74,7 +74,7 @@ subprojects {
7474
def springBootVersion = '2.3.0.RELEASE'
7575
def terasolunaVersion = '5.5.1.RELEASE'
7676
def thymeleafVersion = '3.0.4.RELEASE'
77-
def modelMapperVersion = '0.7.8'
77+
def modelMapperVersion = '2.3.7'
7878
def log4jdbcVersion = '0.2.7'
7979
def dbunitVersion = '2.7.0'
8080
def springTestDbunitVersion = '1.3.0'

gradle.properties

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ asciidoctorVersion='1.5.6'
2121
# SonarQube Configurations
2222
systemProp.sonar.projectKey=webauthn4j-spring-security
2323
# Disable some rules on some files
24-
systemProp.sonar.issue.ignore.multicriteria=j1
24+
systemProp.sonar.issue.ignore.multicriteria=j1,j2
2525
# Inheritance tree of classes should not be too deep
2626
systemProp.sonar.issue.ignore.multicriteria.j1.ruleKey=squid:MaximumInheritanceDepth
2727
systemProp.sonar.issue.ignore.multicriteria.j1.resourceKey=**/*.java
28+
29+
# Inheritance tree of classes should not be too deep
30+
systemProp.sonar.issue.ignore.multicriteria.j2.ruleKey=S110
31+
systemProp.sonar.issue.ignore.multicriteria.j2.resourceKey=**/*.java

samples/fido-server-conformance-test-app/src/main/java/com/webauthn4j/springframework/security/webauthn/sample/domain/config/ModelMapperConfig.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,41 +16,22 @@
1616

1717
package com.webauthn4j.springframework.security.webauthn.sample.domain.config;
1818

19-
import com.webauthn4j.springframework.security.webauthn.sample.domain.entity.UserEntity;
20-
import com.webauthn4j.springframework.security.webauthn.sample.util.modelmapper.PageImplConverter;
21-
import com.webauthn4j.springframework.security.webauthn.sample.util.modelmapper.PageImplProvider;
2219
import com.webauthn4j.springframework.security.webauthn.sample.util.modelmapper.StringToChallengeConverter;
2320
import org.modelmapper.ModelMapper;
2421
import org.springframework.context.annotation.Bean;
2522
import org.springframework.context.annotation.Configuration;
26-
import org.springframework.data.domain.Page;
27-
import org.springframework.data.domain.PageImpl;
2823

2924
/**
3025
* ModelMapper Configuration
3126
*/
3227
@Configuration
3328
public class ModelMapperConfig {
3429

35-
36-
/**
37-
* creates ModelMapper instance
38-
*
39-
* @return ModelMapper
40-
*/
41-
public static ModelMapper createModelMapper() {
42-
return new ModelMapperConfig().modelMapper();
43-
}
44-
4530
@Bean
4631
public ModelMapper modelMapper() {
4732
ModelMapper modelMapper = new ModelMapper();
48-
modelMapper.addConverter(new PageImplConverter<UserEntity, UserEntity>(modelMapper));
4933
modelMapper.addConverter(new StringToChallengeConverter());
5034

51-
modelMapper.createTypeMap(Page.class, PageImpl.class).setProvider(new PageImplProvider());
52-
modelMapper.getTypeMap(PageImpl.class, PageImpl.class).setProvider(new PageImplProvider());
53-
5435
modelMapper.getConfiguration()
5536
.setFieldMatchingEnabled(true)
5637
.setFieldAccessLevel(org.modelmapper.config.Configuration.AccessLevel.PRIVATE);

samples/fido-server-conformance-test-app/src/main/java/com/webauthn4j/springframework/security/webauthn/sample/util/modelmapper/PageImplConverter.java

Lines changed: 0 additions & 76 deletions
This file was deleted.

samples/fido-server-conformance-test-app/src/main/java/com/webauthn4j/springframework/security/webauthn/sample/util/modelmapper/PageImplProvider.java

Lines changed: 0 additions & 34 deletions
This file was deleted.

samples/spa/src/main/java/com/webauthn4j/springframework/security/webauthn/sample/domain/config/ModelMapperConfig.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,48 +16,27 @@
1616

1717
package com.webauthn4j.springframework.security.webauthn.sample.domain.config;
1818

19-
import com.webauthn4j.springframework.security.webauthn.sample.util.modelmapper.PageImplConverter;
20-
import com.webauthn4j.springframework.security.webauthn.sample.util.modelmapper.PageImplProvider;
2119
import com.webauthn4j.springframework.security.webauthn.sample.util.modelmapper.StringToChallengeConverter;
22-
import com.webauthn4j.springframework.security.webauthn.sample.domain.entity.UserEntity;
23-
import com.webauthn4j.springframework.security.webauthn.sample.util.modelmapper.*;
2420
import org.modelmapper.ModelMapper;
2521
import org.springframework.context.annotation.Bean;
2622
import org.springframework.context.annotation.Configuration;
27-
import org.springframework.data.domain.Page;
28-
import org.springframework.data.domain.PageImpl;
2923

3024
/**
3125
* ModelMapper Configuration
3226
*/
3327
@Configuration
3428
public class ModelMapperConfig {
3529

36-
3730
@Bean
3831
public ModelMapper modelMapper() {
3932
ModelMapper modelMapper = new ModelMapper();
40-
modelMapper.addConverter(new PageImplConverter<UserEntity, UserEntity>(modelMapper));
4133
modelMapper.addConverter(new StringToChallengeConverter());
4234

43-
modelMapper.createTypeMap(Page.class, PageImpl.class).setProvider(new PageImplProvider());
44-
modelMapper.getTypeMap(PageImpl.class, PageImpl.class).setProvider(new PageImplProvider());
45-
4635
modelMapper.getConfiguration()
4736
.setFieldMatchingEnabled(true)
4837
.setFieldAccessLevel(org.modelmapper.config.Configuration.AccessLevel.PRIVATE);
4938

5039
return modelMapper;
5140
}
5241

53-
54-
/**
55-
* creates ModelMapper instance
56-
*
57-
* @return ModelMapper
58-
*/
59-
public static ModelMapper createModelMapper() {
60-
return new ModelMapperConfig().modelMapper();
61-
}
62-
6342
}

samples/spa/src/main/java/com/webauthn4j/springframework/security/webauthn/sample/util/modelmapper/PageImplConverter.java

Lines changed: 0 additions & 76 deletions
This file was deleted.

samples/spa/src/main/java/com/webauthn4j/springframework/security/webauthn/sample/util/modelmapper/PageImplProvider.java

Lines changed: 0 additions & 34 deletions
This file was deleted.

settings.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
include "webauthn4j-spring-security-core"
18-
include "webauthn4j-spring-security-thymeleaf"
19-
include "webauthn4j-spring-security-fido-server"
20-
include "webauthn4j-spring-security-test"
17+
include 'webauthn4j-spring-security-core'
18+
include 'webauthn4j-spring-security-thymeleaf'
19+
include 'webauthn4j-spring-security-fido-server'
20+
include 'webauthn4j-spring-security-test'
2121

22-
include "samples:lib:spa-angular-client"
23-
include "samples:spa"
24-
include "samples:fido-server-conformance-test-app"
22+
include 'samples:lib:spa-angular-client'
23+
include 'samples:spa'
24+
include 'samples:fido-server-conformance-test-app'

webauthn4j-spring-security-core/src/main/java/com/webauthn4j/springframework/security/webauthn/WebAuthnAuthenticationProvider.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,12 @@ public Authentication authenticate(Authentication authentication) {
110110
Authenticator authenticator = user.getAuthenticators().stream()
111111
.filter(item -> Arrays.equals(item.getAttestedCredentialData().getCredentialId(), credentialId))
112112
.findFirst()
113-
.orElse(null);
113+
.orElseThrow(()-> new IllegalStateException("credentialId doesn't match."));
114114

115115
preAuthenticationChecks.check(user);
116116
doAuthenticate(authenticationToken, authenticator, user);
117117
postAuthenticationChecks.check(user);
118118

119-
//noinspection ConstantConditions
120119
authenticatorService.updateCounter(credentialId, authenticator.getCounter());
121120

122121
Serializable principalToReturn = user;

0 commit comments

Comments
 (0)