All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.herodotus.engine.access.sms.configuration.AccessSmsConfiguration Maven / Gradle / Ivy

There is a newer version: 3.3.4.0
Show newest version
/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 2020-2030 郑庚伟 ZHENGGENGWEI (码匠君),  Licensed under the AGPL License
 *
 * This file is part of Herodotus Engine.
 *
 * Herodotus Engine is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Herodotus Engine is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see .
 */

package cn.herodotus.engine.access.sms.configuration;

import cn.herodotus.engine.access.sms.annotation.ConditionalOnSmsEnabled;
import cn.herodotus.engine.access.sms.processor.PhoneNumberAccessHandler;
import cn.herodotus.engine.access.sms.properties.SmsProperties;
import cn.herodotus.engine.access.sms.stamp.VerificationCodeStampManager;
import cn.herodotus.engine.assistant.core.enums.AccountType;
import jakarta.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 

Description: 发送短信统一配置

* * @author : gengwei.zheng * @date : 2021/5/25 12:03 */ @Configuration(proxyBeanMethods = false) @ConditionalOnSmsEnabled @EnableConfigurationProperties({SmsProperties.class}) public class AccessSmsConfiguration { private static final Logger log = LoggerFactory.getLogger(AccessSmsConfiguration.class); @PostConstruct public void postConstruct() { log.debug("[Herodotus] |- SDK [Access SMS] Auto Configure."); } @Bean @ConditionalOnMissingBean public VerificationCodeStampManager verificationCodeStampManager(SmsProperties smsProperties) { VerificationCodeStampManager verificationCodeStampManager = new VerificationCodeStampManager(); verificationCodeStampManager.setSmsProperties(smsProperties); log.trace("[Herodotus] |- Bean [Verification Code Stamp Manager] Auto Configure."); return verificationCodeStampManager; } @Bean(AccountType.PHONE_NUMBER_HANDLER) public PhoneNumberAccessHandler phoneNumberAccessHandler(VerificationCodeStampManager verificationCodeStampManager) { PhoneNumberAccessHandler phoneNumberAuthenticationHandler = new PhoneNumberAccessHandler(verificationCodeStampManager); log.trace("[Herodotus] |- Bean [Phone Number SignIn Handler] Auto Configure."); return phoneNumberAuthenticationHandler; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy