Skip to content

Commit

Permalink
Merge pull request #370 from 6QuizOnTheBlock/be/feat/OIDC-setting-cac…
Browse files Browse the repository at this point in the history
…heable

feat: OIDC 토큰 설정
  • Loading branch information
dalcheonroadhead authored May 19, 2024
2 parents 81e3282 + 5f88891 commit c6ab8f4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import com.quiz.ourclass.domain.member.dto.response.MemberMeResponse;
import com.quiz.ourclass.domain.member.entity.Member;
import java.util.List;

public interface MemberRepositoryQuerydsl {


public MemberMeResponse rememberMe(Member me, long orgId);

public List<Member> getOrgMembers(long orgId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.querydsl.jpa.impl.JPAQueryFactory;
import com.quiz.ourclass.domain.member.dto.response.MemberMeResponse;
import com.quiz.ourclass.domain.member.entity.Member;
import java.util.List;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
Expand All @@ -32,4 +33,14 @@ public MemberMeResponse rememberMe(Member me, long orgId) {
.where(memberOrganization.id.eq(orgId))
.fetchOne();
}

@Override
public List<Member> getOrgMembers(long orgId) {
return jpaQueryFactory
.select(member)
.leftJoin(memberOrganization)
.on(memberOrganization.member.eq(member))
.where(memberOrganization.organization.id.eq(orgId))
.fetch();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@


import com.quiz.ourclass.domain.member.dto.response.OIDCPublicKeysResponse;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;

/*
* (name : 실제 구현체가 Application Context에 빈으로 등록될 때 이름
* url : 요청을 보낼 EndPoint)
* */
* (name : 실제 구현체가 Application Context에 빈으로 등록될 때 이름
* url : 요청을 보낼 EndPoint)
* */
@FeignClient(name = "kakao-oicd-client", url = "https://kauth.kakao.com")
public interface KakaoOicdClient {

// 스프링 어노테이션으로 요청 보내기 가능
@Cacheable(value = "OIDC")
@GetMapping("/.well-known/jwks.json")
OIDCPublicKeysResponse getKakaoOIDCOpenKeys();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public RedisCacheConfiguration redisCacheConfiguration() {
@Bean
public RedisCacheManagerBuilderCustomizer redisCacheManagerBuilderCustomizer() {
return (builder) -> builder
.withCacheConfiguration("OICD",
.withCacheConfiguration("OIDC",
RedisCacheConfiguration.defaultCacheConfig()
.computePrefixWith(cacheName -> "OICD:")
.computePrefixWith(cacheName -> "OIDC:")
.entryTtl(Duration.ofDays(7))
.disableCachingNullValues()
.serializeKeysWith(
Expand Down

0 comments on commit c6ab8f4

Please sign in to comment.