9월, 2024의 게시물 표시

SubString Question Tip

Key for Substring Questions is to use to pointer start & end til the substr = str[start:end] meets the condition. So, you can use the template like below. String minWindow(String givenStr, String target) {     //charCount is a map that holds counts of every character of target     //it also means the numbers of each character that should be found in the substring     Map<Character, Integer> charCount = new HashMap<Character, Integer>();     for (int  i = 0;  i < 128; i++)     {         charCount.put((char)i, 0)     }     for(char c : givenStr.toCharArray())     {         charCount.put(c, charCount.get(c) + 1);     }     int start = 0; //pointer used for iteration     int end = 0; //pointer used for iteration     int counter = 0; //counter used to determine whether the window is valid, can vary(by the ...

BE study 14th

이미지
 Spring Security There's a layer called filter in the spring. When the spring receives a http request, the request goes through 'filter's before going into the servlet. Since one filter calls the next filter, the filters are called. Spring Security is used as a form of filter. To be specific, it's implemented in a set of filters called 'SecurityFilterChain'. 1. Authentication Authentication is done like above. As you can see in the above image, ExceptionTranslationFilter invokes the rest of the filter chain(FilterSecurityInterceptor etc). And if the user is not authenticated, or rest of the filter calls 'AuthenticationException' Error, it calls its method 'startAuthenticaion'. the method 1. clears out the ContextHolder 2. backups the original HttpServletRequest 3. authenticationEntryPoint.commence() : This is the requested to the client for his/her credentials. 3-1. BasicAuthenticationEntryPoint: This is used in case of Basic Authentication; it u...