Skip to content

Commit

Permalink
Fix #971: Add column for signature metadata
Browse files Browse the repository at this point in the history
- Remove generics
  • Loading branch information
jandusil committed Sep 6, 2023
1 parent 2406b59 commit 41941ac
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
@AllArgsConstructor
@NoArgsConstructor
@Data
public class PowerAuthSignatureMetadata implements SignatureMetadata<String, Object>, Serializable {
public class PowerAuthSignatureMetadata implements SignatureMetadata, Serializable {

@JsonProperty("signatureDataMethod")
private String signatureDataMethod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@JsonSubTypes.Type(value = PowerAuthSignatureMetadata.class,
name = SignatureMetadataType.POWERAUTH)
})
public interface SignatureMetadata<String, Object> extends Serializable {
public interface SignatureMetadata extends Serializable {

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@Converter
@Component
@Slf4j
public class SignatureMetadataConverter implements AttributeConverter<SignatureMetadata<String, Object>, String> {
public class SignatureMetadataConverter implements AttributeConverter<SignatureMetadata, String> {

private final ObjectMapper objectMapper;

Expand Down Expand Up @@ -66,7 +66,7 @@ public SignatureMetadataConverter(ObjectMapper objectMapper) {
* @return The JSON string representation of the object.
*/
@Override
public String convertToDatabaseColumn(SignatureMetadata<String, Object> attribute) {
public String convertToDatabaseColumn(SignatureMetadata attribute) {
if (attribute == null) {
return "{}";
}
Expand All @@ -85,7 +85,7 @@ public String convertToDatabaseColumn(SignatureMetadata<String, Object> attribut
* @return The converted SignatureMetadata object.
*/
@Override
public SignatureMetadata<String, Object> convertToEntityAttribute(String s) {
public SignatureMetadata convertToEntityAttribute(String s) {
if (StringUtils.isBlank(s)) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/
package io.getlime.security.powerauth.app.server.service.model.signature;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.getlime.security.powerauth.app.server.database.model.PowerAuthSignatureMetadata;
import io.getlime.security.powerauth.app.server.database.model.SignatureMetadata;
import io.getlime.security.powerauth.app.server.database.model.converter.SignatureMetadataConverter;
Expand Down Expand Up @@ -94,7 +93,7 @@ void testRoundTripConversion() {
@Test
void testInvalidJsonInput() {
String invalidJson = "{\"invalidField\":\"someValue\"}";
SignatureMetadata<String, Object> metadata = (PowerAuthSignatureMetadata) converter.convertToEntityAttribute(invalidJson);
SignatureMetadata metadata = converter.convertToEntityAttribute(invalidJson);
assertNull(metadata);
}
}

0 comments on commit 41941ac

Please sign in to comment.