Skip to content

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.somemore.center.controller;

import com.somemore.auth.annotation.CurrentUser;
import com.somemore.global.auth.annotation.CurrentUser;
import com.somemore.center.dto.request.CenterProfileUpdateRequestDto;
import com.somemore.center.usecase.command.UpdateCenterProfileUseCase;
import com.somemore.global.common.response.ApiResponse;
import com.somemore.imageupload.dto.ImageUploadRequestDto;
import com.somemore.imageupload.usecase.ImageUploadUseCase;
import com.somemore.global.imageupload.dto.ImageUploadRequestDto;
import com.somemore.global.imageupload.usecase.ImageUploadUseCase;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.somemore.center.controller;

import com.somemore.auth.signout.usecase.SignOutUseCase;
import com.somemore.global.auth.signout.usecase.SignOutUseCase;
import com.somemore.center.dto.request.CenterSignRequestDto;
import com.somemore.global.common.response.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.somemore.center.controller;

import com.somemore.auth.annotation.CurrentUser;
import com.somemore.global.auth.annotation.CurrentUser;
import com.somemore.center.dto.request.PreferItemCreateRequestDto;
import com.somemore.center.dto.response.PreferItemCreateResponseDto;
import com.somemore.center.usecase.command.CreatePreferItemUseCase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.somemore.community.controller;

import com.somemore.auth.annotation.CurrentUser;
import com.somemore.global.auth.annotation.CurrentUser;
import com.somemore.community.dto.request.CommunityBoardCreateRequestDto;
import com.somemore.community.dto.request.CommunityBoardUpdateRequestDto;
import com.somemore.community.usecase.board.CreateCommunityBoardUseCase;
import com.somemore.community.usecase.board.DeleteCommunityBoardUseCase;
import com.somemore.community.usecase.board.UpdateCommunityBoardUseCase;
import com.somemore.global.common.response.ApiResponse;
import com.somemore.imageupload.dto.ImageUploadRequestDto;
import com.somemore.imageupload.usecase.ImageUploadUseCase;
import com.somemore.global.imageupload.dto.ImageUploadRequestDto;
import com.somemore.global.imageupload.usecase.ImageUploadUseCase;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.somemore.community.controller;

import com.somemore.auth.annotation.CurrentUser;
import com.somemore.global.auth.annotation.CurrentUser;
import com.somemore.community.dto.request.CommunityCommentCreateRequestDto;
import com.somemore.community.dto.request.CommunityCommentUpdateRequestDto;
import com.somemore.community.usecase.comment.CreateCommunityCommentUseCase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.somemore.develop.controller;

import com.somemore.auth.jwt.domain.EncodedToken;
import com.somemore.auth.jwt.domain.TokenType;
import com.somemore.auth.jwt.domain.UserRole;
import com.somemore.auth.jwt.generator.JwtGenerator;
import com.somemore.global.auth.jwt.domain.EncodedToken;
import com.somemore.global.auth.jwt.domain.TokenType;
import com.somemore.global.auth.jwt.domain.UserRole;
import com.somemore.global.auth.jwt.generator.JwtGenerator;
import com.somemore.global.common.response.ApiResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.somemore.auth.annotation;
package com.somemore.global.auth.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.somemore.auth.authentication;
package com.somemore.global.auth.authentication;

import lombok.EqualsAndHashCode;
import org.springframework.security.authentication.AbstractAuthenticationToken;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.somemore.auth.controller;
package com.somemore.global.auth.controller;

import com.somemore.auth.dto.UserInfoResponseDto;
import com.somemore.global.auth.dto.UserInfoResponseDto;
import com.somemore.global.auth.jwt.exception.JwtErrorType;
import com.somemore.global.common.response.ApiResponse;
import com.somemore.global.exception.BadRequestException;
import lombok.RequiredArgsConstructor;
Expand All @@ -11,8 +12,6 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.somemore.auth.jwt.exception.JwtErrorType.INVALID_TOKEN;

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/token")
Expand All @@ -26,7 +25,7 @@ public ApiResponse<UserInfoResponseDto> getUserInfoBySCH() {
String role = authentication.getAuthorities().stream()
.findFirst()
.map(GrantedAuthority::getAuthority)
.orElseThrow(() -> new BadRequestException(INVALID_TOKEN.getMessage()));
.orElseThrow(() -> new BadRequestException(JwtErrorType.INVALID_TOKEN.getMessage()));

return ApiResponse.ok(200,
new UserInfoResponseDto(userId, role),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.somemore.auth.cookie;
package com.somemore.global.auth.cookie;

import com.somemore.auth.jwt.domain.TokenType;
import com.somemore.global.auth.jwt.domain.TokenType;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.somemore.auth.cookie;
package com.somemore.global.auth.cookie;

import jakarta.servlet.http.HttpServletResponse;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.somemore.auth.dto;
package com.somemore.global.auth.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
Expand All @@ -13,4 +13,4 @@ public record UserInfoResponseDto(
@Schema(description = "유저 ROLE")
String role
) {
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.somemore.auth.idpw.filter;
package com.somemore.global.auth.idpw.filter;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.somemore.auth.cookie.CookieUseCase;
import com.somemore.auth.jwt.domain.EncodedToken;
import com.somemore.auth.jwt.domain.UserRole;
import com.somemore.auth.jwt.usecase.GenerateTokensOnLoginUseCase;
import com.somemore.global.auth.cookie.CookieUseCase;
import com.somemore.global.auth.jwt.domain.EncodedToken;
import com.somemore.global.auth.jwt.domain.UserRole;
import com.somemore.global.auth.jwt.usecase.GenerateTokensOnLoginUseCase;
import jakarta.servlet.FilterChain;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
Expand Down Expand Up @@ -69,4 +69,4 @@ private ProblemDetail buildUnauthorizedProblemDetail(AuthenticationException e)
problemDetail.setProperty("timestamp", System.currentTimeMillis());
return problemDetail;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.somemore.auth.idpw.provider;
package com.somemore.global.auth.idpw.provider;

import com.somemore.auth.authentication.JwtAuthenticationToken;
import com.somemore.auth.jwt.domain.EncodedToken;
import com.somemore.auth.jwt.domain.TokenType;
import com.somemore.auth.jwt.domain.UserRole;
import com.somemore.auth.jwt.usecase.JwtUseCase;
import com.somemore.global.auth.authentication.JwtAuthenticationToken;
import com.somemore.global.auth.jwt.domain.EncodedToken;
import com.somemore.global.auth.jwt.domain.TokenType;
import com.somemore.global.auth.jwt.domain.UserRole;
import com.somemore.global.auth.jwt.usecase.JwtUseCase;
import com.somemore.center.usecase.query.CenterSignUseCase;
import lombok.RequiredArgsConstructor;
import org.springframework.security.authentication.AuthenticationProvider;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.somemore.auth.jwt.config;
package com.somemore.global.auth.jwt.config;

import io.jsonwebtoken.security.Keys;
import org.springframework.beans.factory.annotation.Value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.somemore.auth.jwt.domain;
package com.somemore.global.auth.jwt.domain;

public record EncodedToken(String value) {

private final static String UNINITIALIZED = "UNINITIALIZED";
private static final String UNINITIALIZED = "UNINITIALIZED";

public boolean isUninitialized() {
return value == null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.somemore.auth.jwt.domain;
package com.somemore.global.auth.jwt.domain;

import lombok.Getter;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.somemore.auth.jwt.domain;
package com.somemore.global.auth.jwt.domain;

import com.somemore.auth.jwt.exception.JwtException;
import com.somemore.global.auth.jwt.exception.JwtException;
import com.somemore.global.auth.jwt.exception.JwtErrorType;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.GrantedAuthority;

import static com.somemore.auth.jwt.exception.JwtErrorType.UNKNOWN_ERROR;

@RequiredArgsConstructor
public enum UserRole implements GrantedAuthority {
VOLUNTEER("ROLE_VOLUNTEER"),
Expand All @@ -25,6 +24,6 @@ public static UserRole from(String role) {
return userRole;
}
}
throw new JwtException(UNKNOWN_ERROR);
throw new JwtException(JwtErrorType.UNKNOWN_ERROR);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.somemore.auth.jwt.exception;
package com.somemore.global.auth.jwt.exception;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.somemore.auth.jwt.exception;
package com.somemore.global.auth.jwt.exception;

import lombok.Getter;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.somemore.auth.jwt.filter;

import com.somemore.auth.authentication.JwtAuthenticationToken;
import com.somemore.auth.jwt.domain.EncodedToken;
import com.somemore.auth.jwt.domain.TokenType;
import com.somemore.auth.jwt.exception.JwtErrorType;
import com.somemore.auth.jwt.exception.JwtException;
import com.somemore.auth.jwt.usecase.JwtUseCase;
package com.somemore.global.auth.jwt.filter;

import com.somemore.global.auth.authentication.JwtAuthenticationToken;
import com.somemore.global.auth.jwt.domain.EncodedToken;
import com.somemore.global.auth.jwt.domain.TokenType;
import com.somemore.global.auth.jwt.exception.JwtErrorType;
import com.somemore.global.auth.jwt.exception.JwtException;
import com.somemore.global.auth.jwt.usecase.JwtUseCase;
import io.jsonwebtoken.Claims;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.somemore.auth.jwt.filter;
package com.somemore.global.auth.jwt.filter;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.somemore.auth.jwt.exception.JwtException;
import com.somemore.global.auth.jwt.exception.JwtException;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.somemore.auth.jwt.generator;
package com.somemore.global.auth.jwt.generator;

import com.somemore.auth.jwt.domain.EncodedToken;
import com.somemore.auth.jwt.domain.TokenType;
import com.somemore.global.auth.jwt.domain.EncodedToken;
import com.somemore.global.auth.jwt.domain.TokenType;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.security.MacAlgorithm;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.somemore.global.auth.jwt.generator;

import com.somemore.global.auth.jwt.domain.EncodedToken;
import com.somemore.global.auth.jwt.domain.TokenType;

public interface JwtGenerator {
EncodedToken generateToken(String userId, String role, TokenType tokenType);
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.somemore.auth.jwt.parser;
package com.somemore.global.auth.jwt.parser;

import com.somemore.auth.jwt.domain.EncodedToken;
import com.somemore.auth.jwt.exception.JwtErrorType;
import com.somemore.auth.jwt.exception.JwtException;
import com.somemore.global.auth.jwt.domain.EncodedToken;
import com.somemore.global.auth.jwt.exception.JwtErrorType;
import com.somemore.global.auth.jwt.exception.JwtException;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.ExpiredJwtException;
import io.jsonwebtoken.Jwts;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.somemore.auth.jwt.parser;
package com.somemore.global.auth.jwt.parser;

import com.somemore.auth.jwt.domain.EncodedToken;
import com.somemore.global.auth.jwt.domain.EncodedToken;
import io.jsonwebtoken.Claims;

public interface JwtParser {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.somemore.auth.jwt.refresh.domain;
package com.somemore.global.auth.jwt.refresh.domain;

import com.somemore.auth.jwt.domain.EncodedToken;
import com.somemore.global.auth.jwt.domain.EncodedToken;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.somemore.auth.jwt.refresh.manager;
package com.somemore.global.auth.jwt.refresh.manager;

import com.somemore.auth.jwt.domain.EncodedToken;
import com.somemore.auth.jwt.exception.JwtErrorType;
import com.somemore.auth.jwt.exception.JwtException;
import com.somemore.auth.jwt.refresh.domain.RefreshToken;
import com.somemore.auth.jwt.refresh.repository.RefreshTokenRepository;
import com.somemore.global.auth.jwt.domain.EncodedToken;
import com.somemore.global.auth.jwt.exception.JwtErrorType;
import com.somemore.global.auth.jwt.exception.JwtException;
import com.somemore.global.auth.jwt.refresh.domain.RefreshToken;
import com.somemore.global.auth.jwt.refresh.repository.RefreshTokenRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.somemore.auth.jwt.refresh.manager;
package com.somemore.global.auth.jwt.refresh.manager;

import com.somemore.auth.jwt.domain.EncodedToken;
import com.somemore.auth.jwt.refresh.domain.RefreshToken;
import com.somemore.global.auth.jwt.domain.EncodedToken;
import com.somemore.global.auth.jwt.refresh.domain.RefreshToken;

public interface RefreshTokenManager {
RefreshToken findRefreshToken(EncodedToken accessToken);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.somemore.auth.jwt.refresh.refresher;
package com.somemore.global.auth.jwt.refresh.refresher;

import com.somemore.auth.jwt.domain.EncodedToken;
import com.somemore.auth.jwt.domain.TokenType;
import com.somemore.auth.jwt.generator.JwtGenerator;
import com.somemore.auth.jwt.parser.JwtParser;
import com.somemore.auth.jwt.refresh.domain.RefreshToken;
import com.somemore.auth.jwt.refresh.manager.RefreshTokenManager;
import com.somemore.auth.jwt.validator.JwtValidator;
import com.somemore.global.auth.jwt.domain.EncodedToken;
import com.somemore.global.auth.jwt.domain.TokenType;
import com.somemore.global.auth.jwt.generator.JwtGenerator;
import com.somemore.global.auth.jwt.parser.JwtParser;
import com.somemore.global.auth.jwt.refresh.domain.RefreshToken;
import com.somemore.global.auth.jwt.refresh.manager.RefreshTokenManager;
import com.somemore.global.auth.jwt.validator.JwtValidator;
import io.jsonwebtoken.Claims;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.somemore.global.auth.jwt.refresh.refresher;

import com.somemore.global.auth.jwt.domain.EncodedToken;

public interface JwtRefresher {
EncodedToken refreshAccessToken(EncodedToken accessToken);
}
Loading
Loading