2023.01.16.MON

ronglong·2023년 1월 16일
0
  1. 프로그래머스 0단계
import java.util.*;

class Solution {
    public String[] solution(String my_str, int n) {
        List<String> list = new ArrayList<>();

        for(int i=0; i<my_str.length(); i+=n){
            if(i+n>=my_str.length()) list.add(my_str.substring(i,my_str.length()));
            else list.add(my_str.substring(i,i+n));

        }

        return list.toArray(new String[0]); 
    }
}

한 문제 풀었다.
다른 것도 뭔가 차근히 고민하면 풀 수 있을 것 같은데...
내일도 하나라도 풀자.

아, 그리고 변환하는 함수 계속 까먹어서 list to array 이런 거 검색해서 확인한다.
자주 나오는 거는 이제 외울 법도 한디,,
내일부터는 메모장에 알고리즘 풀면서 사용한 함수 이름이라도 정리해둬야겠다.

  1. Spring Security 인증(Authentication)
  • usernamePassword 인증 처리 흐름
    https://docs.spring.io/spring-security/reference/servlet/authentication/architecture.html
  • (AuthenticationFilter) UsernamePasswordAuthenticationFilter
  • (Authentication) UsernamePasswordAuthenticationToken
    - not authenticated yet, with Username, Password
  • (AuthenticationManager) ProviderManager
  • AuthenticationProvider(s) with PasswordEncoder
  • UserDetails loaded by UserDetailsService
  • Authentication in AuthenticationProvider
  • (Authentication) UsernamePasswordAuthenticationToken
    - authenticated, with Principal, Credentials, Collection< GrantedAuthority >
  • SecurityContext, SecurityContextHolder
    - SecurityContext는 나중에 HttpSession에 저장되어 사용자의 인증 상태 유지
  1. 기타
  • 인텔리제이 맥북 단축키 https://mangkyu.tistory.com/139
  • 파라미터 ... 표현 : 파라미터 여러 개 받을 때, 자동으로 배열 처리 https://java.ihoney.pe.kr/155
  • 주말에 공부하다가 문득, '어떻게 인텔리제이를 실행하면, 알아서 http 프로토콜의 로컬호스트 도메인을 가진 페이지를 볼 수 있는 것?' 이라는 원초적인 의문이 들었다.
    나는 아무런 설정도 하지 않았는데, 이건 어떻게 http로 지정되었으며, 서버로 돌아가는건지...
    -> 구황작물팸 친구들(고구마와 토란)에게 물어봤다.
    -> Spring 자체가 HttpServlet 객체로 통신을 주고받도록 내부적으로 구현되어 있기때문에 http로 동작
    -> Spring boot를 사용하면 웹 어플리케이션으로 돌리겠다, 라는 전제가 깔려있음
    -> 현실적으로 http나 https를 쓰지않으면 웹으로 접근 자체가 불가능

    -> 결국 스프링 자체에서 그렇게 구동되도록 설정되어있는 것이었다. 파고들면 너무 딥할 것 같아서 일단 이 정도로 이해해두었다.

<느낀 점>
인증에 사용되는 각각의 컴포넌트들의 실제 구현 코드를 한 번 더 봐야겠다.

지난 주, 스프링 시큐리티 개요에서 너무 많은 내용을 한 번에 넣어놔서 복잡하고 어려웠는데, 인증만 따로 떼어 흐름을 보니까 이해에 훨씬 도움이 되었다.

이거 취업할 수 있는건지 계속 의문이 들지만, 일단 포기하지 말고 끝까지 하자.

0개의 댓글