전체 글(847)
-
FastAPI 이미지 만들기
# 파이썬 alpine tag 참조FROM python:{tag}RUN set -x \ && apk update \ # 계정 추가 && addgroup -g {gid} {group} \ && adduser -u {uid} {user} -G {group} -D \ && echo "{user} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ # 모듈 설치 && apk add bash \ && pip install --upgrade pip \ && pip install fastapi \ && pip install uvicorn# 소스 복사COPY --chown={user}:{group} ./src {workspace}/src ..
2024.09.16 -
Alpine 이미지에 만들기
필요한 패키지 설치# sudo는 필요한 경우만 사용RUN apk add --no-cache bash sudo계정 및 그룹 생성RUN addgroup -g {gid} {group} \ && adduser -u {uid} {user} -G {group} -D계정에 sudo 권한 부여RUN echo "{user} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers소스 복사COPY --chown={user}:{group} {source} {destination}사용자 환경설정USER {user}WORKDIR {workspace}실행# pod에 서비스가 그냥 떠 있도록 함CMD ["tail", "-f", "/dev/null"]
2024.09.16 -
Spring boot Security login이외의 페이지에 exception 내용을 사용자에게 피드백 하기
정보가 맞지 않으면, 해당 페이지를 다시 호출하기 @PostMapping("/test") public String validateLogin(@RequestParam("info") String info, HttpServletRequest request, HttpServletResponse response, Authentication auth, RedirectAttributes redirectAttributes) { String data = "abc"; if(!info.equals(data)) { // exceptin을 사용하면, Login 페이지로 이동함 //throw new BadCredentialsException("Invalid info."); redirectAttribute..
2024.09.14 -
Spring boot Security Filter에 예외 URL 적용
String[] exceptUrl = { "/", "/error",}; OrRequestMatcher orRequestMathcers = new OrRequestMatcher(Util.getRequestMatcher(exceptUrl));NegatedRequestMatcher negatedRequestMatcher = new NegatedRequestMatcher(orRequestMathcers); @Beanpublic SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http.authorizeHttpRequests((requests) -> requests .requestMatchers(except..
2024.09.08 -
String[]을 List로 전환
public static List getRequestMatcher(String[] urls) { return Arrays.stream(urls) .map(AntPathRequestMatcher::new) .collect(Collectors.toList()); }
2024.09.08 -
Spring boot Security 결과값 초기화 방법
session.invalidate()를 수행하면, 모든 값이 초기화 됨
2024.09.08