Merge pull request #9727 from YevhenBondarenko/hotfix/3.6.1
fixed rule-engine stats
This commit is contained in:
		
						commit
						b3a9aafb45
					
				@ -38,6 +38,7 @@ import org.springframework.web.util.UriComponentsBuilder;
 | 
			
		||||
import org.thingsboard.server.common.data.StringUtils;
 | 
			
		||||
import org.thingsboard.server.dao.oauth2.OAuth2Configuration;
 | 
			
		||||
import org.thingsboard.server.dao.oauth2.OAuth2Service;
 | 
			
		||||
import org.thingsboard.server.queue.util.TbCoreComponent;
 | 
			
		||||
import org.thingsboard.server.service.security.auth.oauth2.TbOAuth2ParameterNames;
 | 
			
		||||
import org.thingsboard.server.service.security.model.token.OAuth2AppTokenFactory;
 | 
			
		||||
import org.thingsboard.server.utils.MiscUtils;
 | 
			
		||||
@ -51,6 +52,7 @@ import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
@TbCoreComponent
 | 
			
		||||
@Service
 | 
			
		||||
@Slf4j
 | 
			
		||||
public class CustomOAuth2AuthorizationRequestResolver implements OAuth2AuthorizationRequestResolver {
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,44 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright © 2016-2023 The Thingsboard Authors
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
package org.thingsboard.server.config;
 | 
			
		||||
 | 
			
		||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
 | 
			
		||||
import org.springframework.boot.autoconfigure.security.SecurityProperties;
 | 
			
		||||
import org.springframework.context.annotation.Bean;
 | 
			
		||||
import org.springframework.context.annotation.Configuration;
 | 
			
		||||
import org.springframework.core.annotation.Order;
 | 
			
		||||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
 | 
			
		||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
 | 
			
		||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
 | 
			
		||||
import org.springframework.security.web.SecurityFilterChain;
 | 
			
		||||
 | 
			
		||||
@Configuration
 | 
			
		||||
@EnableWebSecurity
 | 
			
		||||
@EnableGlobalMethodSecurity(prePostEnabled = true)
 | 
			
		||||
@Order(SecurityProperties.BASIC_AUTH_ORDER)
 | 
			
		||||
@ConditionalOnExpression("'${service.type:null}'=='tb-rule-engine'")
 | 
			
		||||
public class TbRuleEngineSecurityConfiguration {
 | 
			
		||||
 | 
			
		||||
    @Bean
 | 
			
		||||
    SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
 | 
			
		||||
        http.headers().cacheControl().and().frameOptions().disable()
 | 
			
		||||
                .and().cors().and().csrf().disable()
 | 
			
		||||
                .authorizeRequests()
 | 
			
		||||
                .antMatchers("/actuator/prometheus").permitAll()
 | 
			
		||||
                .anyRequest().authenticated();
 | 
			
		||||
        return http.build();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -18,11 +18,13 @@ package org.thingsboard.server.service.security.auth.oauth2;
 | 
			
		||||
import org.springframework.security.oauth2.client.web.AuthorizationRequestRepository;
 | 
			
		||||
import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest;
 | 
			
		||||
import org.springframework.stereotype.Component;
 | 
			
		||||
import org.thingsboard.server.queue.util.TbCoreComponent;
 | 
			
		||||
 | 
			
		||||
import javax.servlet.http.HttpServletRequest;
 | 
			
		||||
import javax.servlet.http.HttpServletResponse;
 | 
			
		||||
 | 
			
		||||
@Component
 | 
			
		||||
@TbCoreComponent
 | 
			
		||||
public class HttpCookieOAuth2AuthorizationRequestRepository implements AuthorizationRequestRepository<OAuth2AuthorizationRequest> {
 | 
			
		||||
    public static final String OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME = "oauth2_auth_request";
 | 
			
		||||
    public static final String PREV_URI_PARAMETER = "prevUri";
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user