-
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.
feat: #11 google, apple config 및 Public Key API 추가
- Loading branch information
1 parent
ec351b4
commit 7b2ef3f
Showing
13 changed files
with
161 additions
and
28 deletions.
There are no files selected for viewing
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
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
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
27 changes: 27 additions & 0 deletions
27
src/main/java/com/kcy/fitapet/global/common/security/oauth/apple/AppleApplicationConfig.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,27 @@ | ||
package com.kcy.fitapet.global.common.security.oauth.apple; | ||
|
||
import com.kcy.fitapet.global.common.security.oauth.OauthApplicationConfig; | ||
import jakarta.validation.constraints.NotEmpty; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.ConfigurationPropertiesBinding; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.validation.annotation.Validated; | ||
|
||
@Getter | ||
@Setter | ||
@Validated | ||
@Component | ||
@ConfigurationProperties(prefix = "oauth2.client.provider.apple") | ||
@ConfigurationPropertiesBinding | ||
public class AppleApplicationConfig implements OauthApplicationConfig { | ||
@NotEmpty | ||
private String jwksUri; | ||
@NotEmpty | ||
private String clientId; | ||
@NotEmpty | ||
private String clientSecret; | ||
@NotEmpty | ||
private String clientName; | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/kcy/fitapet/global/common/security/oauth/apple/AppleOauthClient.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,20 @@ | ||
package com.kcy.fitapet.global.common.security.oauth.apple; | ||
|
||
import com.kcy.fitapet.global.common.security.oauth.OauthClient; | ||
import com.kcy.fitapet.global.common.security.oauth.dto.OIDCPublicKeyResponse; | ||
import com.kcy.fitapet.global.config.feign.AppleOauthConfig; | ||
import org.springframework.cache.annotation.Cacheable; | ||
import org.springframework.cloud.openfeign.FeignClient; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
|
||
@FeignClient( | ||
name = "AppleOauthClient", | ||
url = "${oauth2.client.provider.apple.jwks-uri}", | ||
configuration = AppleOauthConfig.class | ||
) | ||
public interface AppleOauthClient extends OauthClient { | ||
@Override | ||
@Cacheable(value = "AppleOauth", cacheManager = "oidcCacheManger") | ||
@GetMapping("/auth/keys") | ||
OIDCPublicKeyResponse getOIDCPublicKey(); | ||
} |
27 changes: 27 additions & 0 deletions
27
...ain/java/com/kcy/fitapet/global/common/security/oauth/google/GoogleApplicationConfig.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,27 @@ | ||
package com.kcy.fitapet.global.common.security.oauth.google; | ||
|
||
import com.kcy.fitapet.global.common.security.oauth.OauthApplicationConfig; | ||
import jakarta.validation.constraints.NotEmpty; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.ConfigurationPropertiesBinding; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.validation.annotation.Validated; | ||
|
||
@Getter | ||
@Setter | ||
@Validated | ||
@Component | ||
@ConfigurationProperties(prefix = "oauth2.client.provider.google") | ||
@ConfigurationPropertiesBinding | ||
public class GoogleApplicationConfig implements OauthApplicationConfig { | ||
@NotEmpty | ||
private String jwksUri; | ||
@NotEmpty | ||
private String clientId; | ||
@NotEmpty | ||
private String clientSecret; | ||
@NotEmpty | ||
private String clientName; | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/kcy/fitapet/global/common/security/oauth/google/GoogleOauthClient.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,20 @@ | ||
package com.kcy.fitapet.global.common.security.oauth.google; | ||
|
||
import com.kcy.fitapet.global.common.security.oauth.OauthClient; | ||
import com.kcy.fitapet.global.common.security.oauth.dto.OIDCPublicKeyResponse; | ||
import com.kcy.fitapet.global.config.feign.GoogleOauthConfig; | ||
import org.springframework.cache.annotation.Cacheable; | ||
import org.springframework.cloud.openfeign.FeignClient; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
|
||
@FeignClient( | ||
name = "GoogleOauthClient", | ||
url = "${oauth2.client.provider.google.jwks-uri}", | ||
configuration = GoogleOauthConfig.class | ||
) | ||
public interface GoogleOauthClient extends OauthClient { | ||
@Override | ||
@Cacheable(value = "GoogleOauth", cacheManager = "oidcCacheManger") | ||
@GetMapping("/oauth2/v3/certs") | ||
OIDCPublicKeyResponse getOIDCPublicKey(); | ||
} |
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
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
12 changes: 12 additions & 0 deletions
12
src/main/java/com/kcy/fitapet/global/config/feign/AppleOauthConfig.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,12 @@ | ||
package com.kcy.fitapet.global.config.feign; | ||
|
||
import feign.codec.Encoder; | ||
import feign.form.FormEncoder; | ||
import org.springframework.context.annotation.Bean; | ||
|
||
public class AppleOauthConfig { | ||
@Bean | ||
Encoder formEncoder() { | ||
return new FormEncoder(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/kcy/fitapet/global/config/feign/GoogleOauthConfig.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,12 @@ | ||
package com.kcy.fitapet.global.config.feign; | ||
|
||
import feign.codec.Encoder; | ||
import feign.form.FormEncoder; | ||
import org.springframework.context.annotation.Bean; | ||
|
||
public class GoogleOauthConfig { | ||
@Bean | ||
Encoder formEncoder() { | ||
return new FormEncoder(); | ||
} | ||
} |
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
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