mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-05-31 09:12:14 +00:00
Check for null value with the appropriate assertion method
This commit is contained in:
parent
823bc971f5
commit
0e30b923f8
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2022 the original author or authors.
|
* Copyright 2002-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -107,7 +107,7 @@ public interface ClaimAccessor {
|
|||||||
}
|
}
|
||||||
Object claimValue = getClaims().get(claim);
|
Object claimValue = getClaims().get(claim);
|
||||||
Instant convertedValue = ClaimConversionService.getSharedInstance().convert(claimValue, Instant.class);
|
Instant convertedValue = ClaimConversionService.getSharedInstance().convert(claimValue, Instant.class);
|
||||||
Assert.isTrue(convertedValue != null,
|
Assert.notNull(convertedValue,
|
||||||
() -> "Unable to convert claim '" + claim + "' of type '" + claimValue.getClass() + "' to Instant.");
|
() -> "Unable to convert claim '" + claim + "' of type '" + claimValue.getClass() + "' to Instant.");
|
||||||
return convertedValue;
|
return convertedValue;
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ public interface ClaimAccessor {
|
|||||||
}
|
}
|
||||||
Object claimValue = getClaims().get(claim);
|
Object claimValue = getClaims().get(claim);
|
||||||
URL convertedValue = ClaimConversionService.getSharedInstance().convert(claimValue, URL.class);
|
URL convertedValue = ClaimConversionService.getSharedInstance().convert(claimValue, URL.class);
|
||||||
Assert.isTrue(convertedValue != null,
|
Assert.notNull(convertedValue,
|
||||||
() -> "Unable to convert claim '" + claim + "' of type '" + claimValue.getClass() + "' to URL.");
|
() -> "Unable to convert claim '" + claim + "' of type '" + claimValue.getClass() + "' to URL.");
|
||||||
return convertedValue;
|
return convertedValue;
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ public interface ClaimAccessor {
|
|||||||
Object claimValue = getClaims().get(claim);
|
Object claimValue = getClaims().get(claim);
|
||||||
Map<String, Object> convertedValue = (Map<String, Object>) ClaimConversionService.getSharedInstance()
|
Map<String, Object> convertedValue = (Map<String, Object>) ClaimConversionService.getSharedInstance()
|
||||||
.convert(claimValue, sourceDescriptor, targetDescriptor);
|
.convert(claimValue, sourceDescriptor, targetDescriptor);
|
||||||
Assert.isTrue(convertedValue != null,
|
Assert.notNull(convertedValue,
|
||||||
() -> "Unable to convert claim '" + claim + "' of type '" + claimValue.getClass() + "' to Map.");
|
() -> "Unable to convert claim '" + claim + "' of type '" + claimValue.getClass() + "' to Map.");
|
||||||
return convertedValue;
|
return convertedValue;
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ public interface ClaimAccessor {
|
|||||||
Object claimValue = getClaims().get(claim);
|
Object claimValue = getClaims().get(claim);
|
||||||
List<String> convertedValue = (List<String>) ClaimConversionService.getSharedInstance()
|
List<String> convertedValue = (List<String>) ClaimConversionService.getSharedInstance()
|
||||||
.convert(claimValue, sourceDescriptor, targetDescriptor);
|
.convert(claimValue, sourceDescriptor, targetDescriptor);
|
||||||
Assert.isTrue(convertedValue != null,
|
Assert.notNull(convertedValue,
|
||||||
() -> "Unable to convert claim '" + claim + "' of type '" + claimValue.getClass() + "' to List.");
|
() -> "Unable to convert claim '" + claim + "' of type '" + claimValue.getClass() + "' to List.");
|
||||||
return convertedValue;
|
return convertedValue;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -353,7 +353,7 @@ class JoseHeader {
|
|||||||
|
|
||||||
private static URL convertAsURL(String header, String value) {
|
private static URL convertAsURL(String header, String value) {
|
||||||
URL convertedValue = ClaimConversionService.getSharedInstance().convert(value, URL.class);
|
URL convertedValue = ClaimConversionService.getSharedInstance().convert(value, URL.class);
|
||||||
Assert.isTrue(convertedValue != null,
|
Assert.notNull(convertedValue,
|
||||||
() -> "Unable to convert header '" + header + "' of type '" + value.getClass() + "' to URL.");
|
() -> "Unable to convert header '" + header + "' of type '" + value.getClass() + "' to URL.");
|
||||||
return convertedValue;
|
return convertedValue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user