-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
api/src/main/java/com/teamnexters/lazy/api/config/auth/dto/ApplePublicKeyResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.teamnexters.lazy.api.config.auth.dto; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Getter | ||
@Setter | ||
public class ApplePublicKeyResponse { | ||
private List<Key> keys; | ||
|
||
@Getter | ||
@Setter | ||
public static class Key { | ||
private String kty; | ||
private String kid; | ||
private String use; | ||
private String alg; | ||
private String n; | ||
private String e; | ||
} | ||
|
||
public Optional<Key> getMatchedKeyBy(Object kid, Object alg) { | ||
return this.keys.stream() | ||
.filter(key -> key.getKid().equals(kid) && key.getAlg().equals(alg)) | ||
.findFirst(); | ||
} | ||
} |