Java Code Examples for com.google.code.kaptcha.impl.DefaultKaptcha#setConfig()
The following examples show how to use
com.google.code.kaptcha.impl.DefaultKaptcha#setConfig() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KaptchaHelper.java From seezoon-framework-all with Apache License 2.0 | 6 votes |
public KaptchaHelper() { Properties properties = new Properties(); properties.setProperty("kaptcha.border", border); properties.setProperty("kaptcha.border.color", borderColor); properties.setProperty("kaptcha.textproducer.font.color", fontColor); properties.setProperty("kaptcha.textproducer.font.size", fontSize); properties.setProperty("kaptcha.image.width", imageWidth); properties.setProperty("kaptcha.image.height", imageHeight); properties.setProperty("kaptcha.textproducer.char.length", charLength); properties.setProperty("kaptcha.textproducer.font.names", fontNames); //间隔 properties.setProperty("kaptcha.textproducer.char.space", "3"); // 图片样式: // 水纹com.google.code.kaptcha.impl.WaterRipple // 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy // 阴影com.google.code.kaptcha.impl.ShadowGimpy properties.setProperty("kaptcha.obscurificator.impl", "com.google.code.kaptcha.impl.FishEyeGimpy"); Config config = new Config(properties); defaultKaptcha = new DefaultKaptcha(); defaultKaptcha.setConfig(config); }
Example 2
Source File: KaptchaProducerAgency.java From dpCms with Apache License 2.0 | 6 votes |
private static void init(){ kaptchaProducer = new DefaultKaptcha(); Properties properties = new Properties(); properties.setProperty("kaptcha.border", "no"); properties.setProperty("kaptcha.textproducer.font.color", "black"); properties.setProperty("kaptcha.noise.color", "black"); properties.setProperty("kaptcha.textproducer.impl", "com.google.code.kaptcha.text.impl.DefaultTextCreator"); properties.setProperty("kaptcha.textproducer.char.string", "1234567890"); properties.setProperty("kaptcha.obscurificator.impl", "com.google.code.kaptcha.impl.ShadowGimpy"); properties.setProperty("kaptcha.image.width", "100"); properties.setProperty("kaptcha.textproducer.font.size", "21"); properties.setProperty("kaptcha.image.height", "40"); properties.setProperty("kaptcha.session.key", "loginCode"); properties.setProperty("kaptcha.textproducer.char.length", "5"); properties.setProperty("kaptcha.textproducer.font.names", "宋体,楷体,微软雅黑"); Config config = new Config(properties); kaptchaProducer.setConfig(config); }
Example 3
Source File: PaasCloudOpcApplication.java From paascloud-master with Apache License 2.0 | 6 votes |
/** * Get kaptcha bean default kaptcha. * * @return the default kaptcha */ @Bean(name = "captchaProducer") public DefaultKaptcha getKaptchaBean() { DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); Properties properties = new Properties(); properties.setProperty("kaptcha.border", "yes"); properties.setProperty("kaptcha.border.color", "105,179,90"); properties.setProperty("kaptcha.textproducer.font.color", "blue"); properties.setProperty("kaptcha.image.width", "125"); properties.setProperty("kaptcha.image.height", "45"); properties.setProperty("kaptcha.session.key", "code"); properties.setProperty("kaptcha.textproducer.char.length", "4"); properties.setProperty("kaptcha.textproducer.font.names", "宋体,楷体,微软雅黑"); Config config = new Config(properties); defaultKaptcha.setConfig(config); return defaultKaptcha; }
Example 4
Source File: CaptchaConfig.java From paascloud-master with Apache License 2.0 | 6 votes |
/** * Get kaptcha bean default kaptcha. * * @return the default kaptcha */ @Bean(name = "captchaProducer") public DefaultKaptcha getKaptchaBean() { DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); Properties properties = new Properties(); properties.setProperty("kaptcha.border", "no"); properties.setProperty("kaptcha.border.color", "no"); properties.setProperty("kaptcha.border.color", "220,227,232"); properties.setProperty("kaptcha.textproducer.char.string", "2345689"); properties.setProperty("kaptcha.textproducer.font.color", "black"); properties.setProperty("kaptcha.textproducer.font.size", "16"); properties.setProperty("kaptcha.image.width", "106"); properties.setProperty("kaptcha.image.height", "30"); properties.setProperty("kaptcha.session.key", "kaptchaCode"); properties.setProperty("kaptcha.textproducer.char.length", "4"); properties.setProperty("kaptcha.background.clear.from", "white"); properties.setProperty("kaptcha.background.clear.to", "white"); properties.setProperty("kaptcha.textproducer.char.space", "5"); properties.setProperty("kaptcha.obscurificator.impl", "com.google.code.kaptcha.impl.ShadowGimpy"); properties.setProperty("kaptcha.noise.impl", "com.google.code.kaptcha.impl.NoNoise"); properties.setProperty("kaptcha.textproducer.font.names", "Verdana"); Config config = new Config(properties); defaultKaptcha.setConfig(config); return defaultKaptcha; }
Example 5
Source File: WebConfig.java From Guns with GNU Lesser General Public License v3.0 | 6 votes |
/** * 验证码生成相关 */ @Bean public DefaultKaptcha kaptcha() { Properties properties = new Properties(); properties.put("kaptcha.border", "no"); properties.put("kaptcha.border.color", "105,179,90"); properties.put("kaptcha.textproducer.font.color", "blue"); properties.put("kaptcha.image.width", "125"); properties.put("kaptcha.image.height", "45"); properties.put("kaptcha.textproducer.font.size", "45"); properties.put("kaptcha.session.key", "code"); properties.put("kaptcha.textproducer.char.length", "4"); properties.put("kaptcha.textproducer.font.names", "宋体,楷体,微软雅黑"); Config config = new Config(properties); DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); defaultKaptcha.setConfig(config); return defaultKaptcha; }
Example 6
Source File: CaptchaConfig.java From RuoYi with Apache License 2.0 | 5 votes |
@Bean(name = "captchaProducer") public DefaultKaptcha getKaptchaBean() { DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); Properties properties = new Properties(); // 是否有边框 默认为true 我们可以自己设置yes,no properties.setProperty("kaptcha.border", "yes"); // 边框颜色 默认为Color.BLACK properties.setProperty("kaptcha.border.color", "105,179,90"); // 验证码文本字符颜色 默认为Color.BLACK properties.setProperty("kaptcha.textproducer.font.color", "blue"); // 验证码图片宽度 默认为200 properties.setProperty("kaptcha.image.width", "180"); // 验证码图片高度 默认为50 properties.setProperty("kaptcha.image.height", "60"); // 验证码文本字符大小 默认为40 properties.setProperty("kaptcha.textproducer.font.size", "30"); // KAPTCHA_SESSION_KEY properties.setProperty("kaptcha.session.key", "kaptchaCode"); // 验证码文本字符间距 默认为2 properties.setProperty("kaptcha.textproducer.char.space", "3"); // 验证码文本字符长度 默认为5 properties.setProperty("kaptcha.textproducer.char.length", "6"); // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) properties.setProperty("kaptcha.textproducer.font.names", "Arial,Courier"); // 验证码噪点颜色 默认为Color.BLACK properties.setProperty("kaptcha.noise.color", "white"); Config config = new Config(properties); defaultKaptcha.setConfig(config); return defaultKaptcha; }
Example 7
Source File: KaptchaConfig.java From fw-cloud-framework with MIT License | 5 votes |
@Bean public DefaultKaptcha producer() { Properties properties = new Properties(); properties.put(KAPTCHA_BORDER, SecurityConstant.DEFAULT_IMAGE_BORDER); properties.put(KAPTCHA_TEXTPRODUCER_FONT_COLOR, SecurityConstant.DEFAULT_COLOR_FONT); properties.put(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, SecurityConstant.DEFAULT_CHAR_SPACE); properties.put(KAPTCHA_IMAGE_WIDTH, SecurityConstant.DEFAULT_IMAGE_WIDTH); properties.put(KAPTCHA_IMAGE_HEIGHT, SecurityConstant.DEFAULT_IMAGE_HEIGHT); properties.put(KAPTCHA_IMAGE_FONT_SIZE, SecurityConstant.DEFAULT_IMAGE_FONT_SIZE); properties.put(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, SecurityConstant.DEFAULT_IMAGE_LENGTH); Config config = new Config(properties); DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); defaultKaptcha.setConfig(config); return defaultKaptcha; }
Example 8
Source File: KaptchaConfig.java From pig with MIT License | 5 votes |
@Bean public DefaultKaptcha producer() { Properties properties = new Properties(); properties.put(KAPTCHA_BORDER, SecurityConstants.DEFAULT_IMAGE_BORDER); properties.put(KAPTCHA_TEXTPRODUCER_FONT_COLOR, SecurityConstants.DEFAULT_COLOR_FONT); properties.put(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, SecurityConstants.DEFAULT_CHAR_SPACE); properties.put(KAPTCHA_IMAGE_WIDTH, SecurityConstants.DEFAULT_IMAGE_WIDTH); properties.put(KAPTCHA_IMAGE_HEIGHT, SecurityConstants.DEFAULT_IMAGE_HEIGHT); properties.put(KAPTCHA_IMAGE_FONT_SIZE, SecurityConstants.DEFAULT_IMAGE_FONT_SIZE); properties.put(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, SecurityConstants.DEFAULT_IMAGE_LENGTH); Config config = new Config(properties); DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); defaultKaptcha.setConfig(config); return defaultKaptcha; }
Example 9
Source File: KaptchaConfig.java From Taroco with Apache License 2.0 | 5 votes |
@Bean public DefaultKaptcha producer() { Properties properties = new Properties(); properties.put(KAPTCHA_BORDER, SecurityConstants.DEFAULT_IMAGE_BORDER); properties.put(KAPTCHA_TEXTPRODUCER_FONT_COLOR, SecurityConstants.DEFAULT_COLOR_FONT); properties.put(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, SecurityConstants.DEFAULT_CHAR_SPACE); properties.put(KAPTCHA_IMAGE_WIDTH, SecurityConstants.DEFAULT_IMAGE_WIDTH); properties.put(KAPTCHA_IMAGE_HEIGHT, SecurityConstants.DEFAULT_IMAGE_HEIGHT); properties.put(KAPTCHA_IMAGE_FONT_SIZE, SecurityConstants.DEFAULT_IMAGE_FONT_SIZE); properties.put(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, SecurityConstants.DEFAULT_IMAGE_LENGTH); Config config = new Config(properties); DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); defaultKaptcha.setConfig(config); return defaultKaptcha; }
Example 10
Source File: CaptchaConfig.java From oauth-server with Apache License 2.0 | 5 votes |
@Bean(name = "captchaProducer") public DefaultKaptcha getKaptchaBean() { DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); Properties properties = new Properties(); properties.setProperty("kaptcha.border", "yes"); properties.setProperty("kaptcha.border.color", "105,179,90"); properties.setProperty("kaptcha.textproducer.font.color", "blue"); properties.setProperty("kaptcha.image.width", "125"); properties.setProperty("kaptcha.image.height", "45"); properties.setProperty("kaptcha.session.key", "code"); properties.setProperty("kaptcha.textproducer.char.length", "4"); Config config = new Config(properties); defaultKaptcha.setConfig(config); return defaultKaptcha; }
Example 11
Source File: CaptchaConfig.java From LuckyFrameWeb with GNU Affero General Public License v3.0 | 5 votes |
@Bean(name = "captchaProducerMath") public DefaultKaptcha getKaptchaBeanMath() { DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); Properties properties = new Properties(); // 是否有边框 默认为true 我们可以自己设置yes,no properties.setProperty("kaptcha.border", "yes"); // 边框颜色 默认为Color.BLACK properties.setProperty("kaptcha.border.color", "105,179,90"); // 验证码文本字符颜色 默认为Color.BLACK properties.setProperty("kaptcha.textproducer.font.color", "blue"); // 验证码图片宽度 默认为200 properties.setProperty("kaptcha.image.width", "160"); // 验证码图片高度 默认为50 properties.setProperty("kaptcha.image.height", "60"); // 验证码文本字符大小 默认为40 properties.setProperty("kaptcha.textproducer.font.size", "35"); // KAPTCHA_SESSION_KEY properties.setProperty("kaptcha.session.key", "kaptchaCodeMath"); // 验证码文本生成器 properties.setProperty("kaptcha.textproducer.impl", "com.luckyframe.framework.config.KaptchaTextCreator"); // 验证码文本字符间距 默认为2 properties.setProperty("kaptcha.textproducer.char.space", "3"); // 验证码文本字符长度 默认为5 properties.setProperty("kaptcha.textproducer.char.length", "6"); // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) properties.setProperty("kaptcha.textproducer.font.names", "Arial,Courier"); // 验证码噪点颜色 默认为Color.BLACK properties.setProperty("kaptcha.noise.color", "white"); // 干扰实现类 properties.setProperty("kaptcha.noise.impl", "com.google.code.kaptcha.impl.NoNoise"); // 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy properties.setProperty("kaptcha.obscurificator.impl", "com.google.code.kaptcha.impl.ShadowGimpy"); Config config = new Config(properties); defaultKaptcha.setConfig(config); return defaultKaptcha; }
Example 12
Source File: KaptchaConfig.java From sophia_scaffolding with Apache License 2.0 | 5 votes |
@Bean public DefaultKaptcha producer() { Properties properties = new Properties(); properties.put(KAPTCHA_BORDER, DEFAULT_IMAGE_BORDER); properties.put(KAPTCHA_TEXTPRODUCER_FONT_COLOR, DEFAULT_COLOR_FONT); properties.put(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, DEFAULT_CHAR_SPACE); properties.put(KAPTCHA_IMAGE_WIDTH, DEFAULT_IMAGE_WIDTH); properties.put(KAPTCHA_IMAGE_HEIGHT, DEFAULT_IMAGE_HEIGHT); properties.put(KAPTCHA_IMAGE_FONT_SIZE, DEFAULT_IMAGE_FONT_SIZE); properties.put(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, DEFAULT_IMAGE_LENGTH); Config config = new Config(properties); DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); defaultKaptcha.setConfig(config); return defaultKaptcha; }
Example 13
Source File: KaptchaConfig.java From renren-fast with GNU General Public License v3.0 | 5 votes |
@Bean public DefaultKaptcha producer() { Properties properties = new Properties(); properties.put("kaptcha.border", "no"); properties.put("kaptcha.textproducer.font.color", "black"); properties.put("kaptcha.textproducer.char.space", "5"); Config config = new Config(properties); DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); defaultKaptcha.setConfig(config); return defaultKaptcha; }
Example 14
Source File: KaptchaConfig.java From sdb-mall with Apache License 2.0 | 5 votes |
@Bean public DefaultKaptcha producer() { Properties properties = new Properties(); properties.put("kaptcha.border", "no"); properties.put("kaptcha.textproducer.font.color", "black"); properties.put("kaptcha.textproducer.char.space", "5"); Config config = new Config(properties); DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); defaultKaptcha.setConfig(config); return defaultKaptcha; }
Example 15
Source File: KaptchaAutoConfiguration.java From MaxKey with Apache License 2.0 | 5 votes |
/** * Captcha Producer Config . * @return Producer * @throws IOException kaptcha.properties is null */ @Bean (name = "captchaProducer") public Producer captchaProducer() throws IOException { Resource resource = new ClassPathResource( ConstantsProperties.classPathResource(ConstantsProperties.kaptchaPropertySource)); _logger.debug("Kaptcha config file " + resource.getURL()); DefaultKaptcha kaptcha = new DefaultKaptcha(); Properties properties = new Properties(); properties.load(resource.getInputStream()); Config config = new Config(properties); kaptcha.setConfig(config); return kaptcha; }
Example 16
Source File: KaptchaConfiguration.java From albedo with GNU Lesser General Public License v3.0 | 5 votes |
@Bean public DefaultKaptcha producer() { Properties properties = new Properties(); properties.put(KAPTCHA_BORDER, CommonConstants.DEFAULT_IMAGE_BORDER); properties.put(KAPTCHA_TEXTPRODUCER_FONT_COLOR, CommonConstants.DEFAULT_COLOR_FONT); properties.put(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, CommonConstants.DEFAULT_CHAR_SPACE); properties.put(KAPTCHA_IMAGE_WIDTH, CommonConstants.DEFAULT_IMAGE_WIDTH); properties.put(KAPTCHA_IMAGE_HEIGHT, CommonConstants.DEFAULT_IMAGE_HEIGHT); properties.put(KAPTCHA_IMAGE_FONT_SIZE, CommonConstants.DEFAULT_IMAGE_FONT_SIZE); properties.put(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, CommonConstants.DEFAULT_IMAGE_LENGTH); Config config = new Config(properties); DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); defaultKaptcha.setConfig(config); return defaultKaptcha; }
Example 17
Source File: KaptchaConfig.java From open-capacity-platform with Apache License 2.0 | 5 votes |
@Bean public DefaultKaptcha producer() { Properties properties = new Properties(); properties.put(KAPTCHA_BORDER, "no"); properties.put(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "blue"); properties.put(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, 5); properties.put(KAPTCHA_IMAGE_WIDTH, "100"); properties.put(KAPTCHA_IMAGE_HEIGHT, "35"); properties.put(KAPTCHA_IMAGE_FONT_SIZE, "30"); properties.put(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "4"); Config config = new Config(properties); DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); defaultKaptcha.setConfig(config); return defaultKaptcha; }
Example 18
Source File: KaptchaConfiguration.java From ml-blog with MIT License | 5 votes |
@Bean public DefaultKaptcha producer() { Properties properties = new Properties(); properties.put("kaptcha.border", "no"); properties.put("kaptcha.image.width","110"); properties.put("kaptcha.image.height","45"); properties.put("kaptcha.textproducer.font.size","35"); properties.put("kaptcha.textproducer.font.color", "black"); properties.put("kaptcha.textproducer.char.length", "4"); Config config = new Config(properties); DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); defaultKaptcha.setConfig(config); return defaultKaptcha; }
Example 19
Source File: KaptchaConfiguration.java From smaker with GNU Lesser General Public License v3.0 | 5 votes |
@Bean public DefaultKaptcha producer() { Properties properties = new Properties(); properties.put(KAPTCHA_BORDER, DEFAULT_IMAGE_BORDER); properties.put(KAPTCHA_TEXTPRODUCER_FONT_COLOR, DEFAULT_COLOR_FONT); properties.put(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, DEFAULT_CHAR_SPACE); properties.put(KAPTCHA_IMAGE_WIDTH, DEFAULT_IMAGE_WIDTH); properties.put(KAPTCHA_IMAGE_HEIGHT, DEFAULT_IMAGE_HEIGHT); properties.put(KAPTCHA_IMAGE_FONT_SIZE, DEFAULT_IMAGE_FONT_SIZE); properties.put(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, DEFAULT_IMAGE_LENGTH); Config config = new Config(properties); DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); defaultKaptcha.setConfig(config); return defaultKaptcha; }
Example 20
Source File: CaptchaConfig.java From supplierShop with MIT License | 5 votes |
@Bean(name = "captchaProducerMath") public DefaultKaptcha getKaptchaBeanMath() { DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); Properties properties = new Properties(); // 是否有边框 默认为true 我们可以自己设置yes,no properties.setProperty(KAPTCHA_BORDER, "yes"); // 边框颜色 默认为Color.BLACK properties.setProperty(KAPTCHA_BORDER_COLOR, "105,179,90"); // 验证码文本字符颜色 默认为Color.BLACK properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "blue"); // 验证码图片宽度 默认为200 properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160"); // 验证码图片高度 默认为50 properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60"); // 验证码文本字符大小 默认为40 properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "35"); // KAPTCHA_SESSION_KEY properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCodeMath"); // 验证码文本生成器 properties.setProperty(KAPTCHA_TEXTPRODUCER_IMPL, "com.ruoyi.framework.config.KaptchaTextCreator"); // 验证码文本字符间距 默认为2 properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, "3"); // 验证码文本字符长度 默认为5 properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "6"); // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier"); // 验证码噪点颜色 默认为Color.BLACK properties.setProperty(KAPTCHA_NOISE_COLOR, "white"); // 干扰实现类 properties.setProperty(KAPTCHA_NOISE_IMPL, "com.google.code.kaptcha.impl.NoNoise"); // 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy"); Config config = new Config(properties); defaultKaptcha.setConfig(config); return defaultKaptcha; }