/*
 * Copyright (c) 2023 codvision.com All Rights Reserved.
 */

package com.codvision.auth.config;

import com.codvision.auth.core.AuthCenterService;
import com.codvision.auth.core.token.ITokenManager;
import com.codvision.auth.core.token.RedisTokenManager;
import com.codvision.authcore.config.AuthProperties;
import com.codvision.authcore.service.IAuthService;
import com.codvision.authcore.service.impl.AuthService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.annotation.Order;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * 认证中心配置
 *
 * @author lingee
 * @date 2023/11/21
 */
@Configuration
@ConditionalOnProperty(value = "cvbp.auth.enabled", havingValue = "true", matchIfMissing = true)
public class AuthCenterConfig {

    @Bean
    public IAuthService authService() {
        return new AuthCenterService();
    }

    @Bean
    public ITokenManager tokenManager() {
        return new RedisTokenManager();
    }
}
