package com.inkasso.auth.config;

import com.inkasso.auth.PermissionCheckBean;
import com.inkasso.auth.scanner.PermissionScanner;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 张超
 * @date 2021/11/3
 */
@Configuration
public class AuthorizationConfig {


  @Bean
  public PermissionScanner permissionScanner() {

    return new PermissionScanner();
  }

  @Bean
  @ConditionalOnProperty(prefix = "kafubao",name="authorization",havingValue = "true",matchIfMissing = false)
  public PermissionInit permissionInit(){
    return new PermissionInit();
  }

  @Bean
  @ConditionalOnProperty(prefix = "kafubao",name="authorization",havingValue = "true",matchIfMissing = false)
  public PermissionCheckBean permissionCheckBean(){

    return new PermissionCheckBean();
  }

}
