Token.java 19.2 KB
Newer Older
R
test  
roo00 已提交
1 2 3
package com.x.base.core.project.config;

import java.io.File;
Z
zhourui 已提交
4 5 6 7
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
R
test  
roo00 已提交
8 9 10 11 12 13
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

Z
zhourui 已提交
14 15 16 17
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;

Z
zhourui 已提交
18
import org.apache.commons.codec.digest.DigestUtils;
R
test  
roo00 已提交
19
import org.apache.commons.io.FileUtils;
O
o2sword 已提交
20
import org.apache.commons.lang3.BooleanUtils;
R
test  
roo00 已提交
21 22 23 24 25 26
import org.apache.commons.lang3.StringUtils;

import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.gson.GsonPropertyObject;
import com.x.base.core.project.gson.XGsonBuilder;
import com.x.base.core.project.organization.OrganizationDefinition;
R
Ray 已提交
27 28
import com.x.base.core.project.tools.BaseTools;
import com.x.base.core.project.tools.Crypto;
R
test  
roo00 已提交
29 30 31 32
import com.x.base.core.project.tools.DefaultCharset;

public class Token extends ConfigObject {

Z
fix  
zhourui 已提交
33 34
	private static final long serialVersionUID = 397619753053929409L;

R
test  
roo00 已提交
35 36 37 38 39 40 41 42
	private static final String surfix = "o2platform";

	public static final String defaultInitialManager = "xadmin";

	public static final String defaultInitialManagerDistinguishedName = "xadmin@o2oa@P";

	public static final String initPassword = "o2";

NoSubject's avatar
NoSubject 已提交
43 44
	public static final String defaultSslKeyStorePassword = "123456";
	public static final String defaultSslKeyManagerPassword = "123456";
R
test  
roo00 已提交
45

Z
zhourui 已提交
46 47
	public static final Boolean DEFAULT_RSAENABLE = false;

Z
zhourui 已提交
48 49 50 51 52
	// 此对象临时计算无需存储
	private transient String _cipher = "";
	// 此对象临时计算无需存储
	private transient String _password = "";

R
test  
roo00 已提交
53
	public static Token defaultInstance() {
Z
zhourui 已提交
54
		return new Token();
R
test  
roo00 已提交
55 56 57 58 59 60 61
	}

	public Token() {
		this.key = "";
		this.password = "";
		this.sslKeyStorePassword = defaultSslKeyStorePassword;
		this.sslKeyManagerPassword = defaultSslKeyManagerPassword;
62

Z
zhourui 已提交
63
		this.rsaEnable = DEFAULT_RSAENABLE;
R
test  
roo00 已提交
64 65
	}

Z
zhourui 已提交
66
	// 加密用的key,用于加密口令
R
test  
roo00 已提交
67 68 69 70 71 72 73 74 75 76 77 78
	@FieldDescribe("加密用口令的密钥,修改后会导致用户口令验证失败.")
	private String key;

	@FieldDescribe("初始管理员密码,用于内部数据库和FTP文件服务器,以及http的token加密.")
	private String password;

	@FieldDescribe("ssl密码")
	private String sslKeyStorePassword;

	@FieldDescribe("ssl管理密码")
	private String sslKeyManagerPassword;

O
o2sword 已提交
79 80 81
	@FieldDescribe("LDAP认证配置")
	private LdapAuth ldapAuth;

R
test  
roo00 已提交
82 83 84 85 86 87 88 89 90
	@FieldDescribe("sso登录配置")
	private List<Sso> ssos = new ArrayList<>();

	@FieldDescribe("oauth单点登录配置")
	private List<Oauth> oauths = new ArrayList<>();

	@FieldDescribe("作为客户端单点登录配置")
	private List<OauthClient> oauthClients = new ArrayList<>();

Z
zhourui 已提交
91 92 93 94 95 96 97
	@FieldDescribe("启用rsa加密.")
	private Boolean rsaEnable = DEFAULT_RSAENABLE;

	public Boolean getRsaEnable() {
		return null == this.rsaEnable ? DEFAULT_RSAENABLE : this.rsaEnable;
	}

Z
zhourui 已提交
98
	// 前面的代码是 key+surfix 结果是nullo2platform
R
test  
roo00 已提交
99 100 101 102 103 104 105 106 107 108 109 110 111
	public String getKey() {
		String val = Objects.toString(key, "") + surfix;
		return StringUtils.substring(val, 0, 8);
	}

	public void setKey(String key) {
		if (StringUtils.equals(key, StringUtils.substring(surfix, 0, 8))) {
			this.key = null;
		} else {
			this.key = key;
		}
	}

Z
zhourui 已提交
112
	public String getCipher() {
Z
zhourui 已提交
113 114 115 116
		if (StringUtils.isEmpty(this._cipher)) {
			this._cipher = DigestUtils.md5Hex(this.getPassword());
		}
		return this._cipher;
R
test  
roo00 已提交
117 118
	}

Z
zhourui 已提交
119
	public String getPassword() {
Z
zhourui 已提交
120 121 122 123
		if (StringUtils.isEmpty(this._password)) {
			this._password = StringUtils.isEmpty(this.password) ? initPassword : Crypto.plainText(this.password);
		}
		return this._password;
R
test  
roo00 已提交
124 125
	}

Z
zhourui 已提交
126 127 128
	public void setPassword(String password)
			throws InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException,
			IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException {
R
test  
roo00 已提交
129 130 131
		if (StringUtils.equals(password, initPassword)) {
			this.password = null;
		} else {
Z
zhourui 已提交
132
			this.password = Crypto.formattedDefaultEncrypt(password);
R
test  
roo00 已提交
133 134 135 136
		}
	}

	public String getInitialManager() {
Z
zhourui 已提交
137
		return defaultInitialManager;
R
test  
roo00 已提交
138 139 140
	}

	public String getInitialManagerDistinguishedName() {
Z
zhourui 已提交
141
		return defaultInitialManagerDistinguishedName;
R
test  
roo00 已提交
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
	}

	public String getSslKeyStorePassword() {
		return StringUtils.isEmpty(this.sslKeyStorePassword) ? defaultSslKeyStorePassword : this.sslKeyStorePassword;
	}

	public void setSslKeyStorePassword(String sslKeyStorePassword) {
		if (StringUtils.equals(sslKeyStorePassword, defaultSslKeyStorePassword)) {
			this.sslKeyStorePassword = null;
		} else {
			this.sslKeyStorePassword = sslKeyStorePassword;
		}
	}

	public String getSslKeyManagerPassword() {
		return StringUtils.isEmpty(this.sslKeyManagerPassword) ? defaultSslKeyManagerPassword
				: this.sslKeyManagerPassword;
	}

	public void setSslKeyManagerPassword(String sslKeyManagerPassword) {
		if (StringUtils.equals(sslKeyManagerPassword, defaultSslKeyManagerPassword)) {
			this.sslKeyManagerPassword = null;
		} else {
			this.sslKeyManagerPassword = sslKeyManagerPassword;
		}
	}

	public List<Oauth> getOauths() {
		if (null == this.oauths) {
			return new ArrayList<Oauth>();
		}
		return this.oauths;
	}

	public List<Sso> getSsos() {
		if (null == this.ssos) {
			return new ArrayList<Sso>();
		}
		return this.ssos;
	}

O
o2sword 已提交
183 184 185 186 187 188 189 190
	public LdapAuth getLdapAuth() {
		return this.ldapAuth == null ? LdapAuth.defaultInstance() : this.ldapAuth;
	}

	public void setLdapAuth(LdapAuth ldapAuth) {
		this.ldapAuth = ldapAuth;
	}

R
test  
roo00 已提交
191 192 193 194 195 196 197 198 199 200 201
	public void setOauths(List<Oauth> oauths) {
		this.oauths = oauths;
	}

	public void setSsos(List<Sso> ssos) {
		this.ssos = ssos;
	}

	public void save() throws Exception {
		File file = new File(Config.base(), Config.PATH_CONFIG_TOKEN);
		FileUtils.write(file, XGsonBuilder.toJson(this), DefaultCharset.charset);
Z
zhourui 已提交
202
		BaseTools.executeSyncFile(Config.PATH_CONFIG_TOKEN);
R
test  
roo00 已提交
203 204
	}

O
o2sword 已提交
205
	public boolean isInitialManager(String name) throws Exception {
Z
zhourui 已提交
206
		if (BooleanUtils.isTrue(Config.ternaryManagement().getEnable())) {
O
o2sword 已提交
207
			return Config.ternaryManagement().isTernaryManagement(name);
Z
zhourui 已提交
208
		} else {
O
o2sword 已提交
209 210 211 212 213 214
			return StringUtils.equals(this.getInitialManager(), name)
					|| StringUtils.equals(this.getInitialManagerDistinguishedName(), name);
		}
	}

	public boolean verifyPassword(String name, String password) throws Exception {
Z
zhourui 已提交
215
		if (BooleanUtils.isTrue(Config.ternaryManagement().getEnable())) {
O
o2sword 已提交
216
			return Config.ternaryManagement().verifyPassword(name, password);
Z
zhourui 已提交
217
		} else {
O
o2sword 已提交
218 219
			return StringUtils.equals(this.getPassword(), password);
		}
R
test  
roo00 已提交
220 221 222 223 224 225 226 227 228
	}

	public InitialManager initialManagerInstance() {
		InitialManager o = new InitialManager();
		String name = this.getInitialManager();
		o.name = name;
		o.id = name;
		o.employee = name;
		o.display = name;
R
roo00 已提交
229
		o.mail = name + "@o2oa.net";
R
test  
roo00 已提交
230 231 232 233 234 235
		o.setDistinguishedName(defaultInitialManagerDistinguishedName);
		o.weixin = "";
		o.qq = "";
		o.weibo = "";
		o.mobile = "";
		o.roleList = new ArrayList<String>();
O
o2sword 已提交
236 237 238 239
		o.roleList.add(OrganizationDefinition.toDistinguishedName(OrganizationDefinition.Manager));
		o.roleList.add(OrganizationDefinition.toDistinguishedName(OrganizationDefinition.OrganizationManager));
		o.roleList.add(OrganizationDefinition.toDistinguishedName(OrganizationDefinition.MeetingManager));
		o.roleList.add(OrganizationDefinition.toDistinguishedName(OrganizationDefinition.ProcessPlatformManager));
R
test  
roo00 已提交
240 241 242 243
		return o;
	}

	public class InitialManager extends GsonPropertyObject {
Z
zhourui 已提交
244 245 246

		private static final long serialVersionUID = 6295964037824026773L;

R
test  
roo00 已提交
247 248 249 250 251 252 253 254 255 256 257
		private String name;
		private String unique;
		private String id;
		private String distinguishedName;
		private String employee;
		private String display;
		private String mail;
		private String weixin;
		private String qq;
		private String weibo;
		private String mobile;
NoSubject's avatar
NoSubject 已提交
258 259
		private String pinyin;
		private String pinyinInitial;
R
test  
roo00 已提交
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357
		private List<String> roleList;

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public String getEmployee() {
			return employee;
		}

		public void setEmployee(String employee) {
			this.employee = employee;
		}

		public String getDisplay() {
			return display;
		}

		public void setDisplay(String display) {
			this.display = display;
		}

		public String getMail() {
			return mail;
		}

		public void setMail(String mail) {
			this.mail = mail;
		}

		public String getWeixin() {
			return weixin;
		}

		public void setWeixin(String weixin) {
			this.weixin = weixin;
		}

		public String getQq() {
			return qq;
		}

		public void setQq(String qq) {
			this.qq = qq;
		}

		public String getWeibo() {
			return weibo;
		}

		public void setWeibo(String weibo) {
			this.weibo = weibo;
		}

		public String getMobile() {
			return mobile;
		}

		public void setMobile(String mobile) {
			this.mobile = mobile;
		}

		public String getId() {
			return id;
		}

		public void setId(String id) {
			this.id = id;
		}

		public List<String> getRoleList() {
			return roleList;
		}

		public void setRoleList(List<String> roleList) {
			this.roleList = roleList;
		}

		public String getUnique() {
			return unique;
		}

		public void setUnique(String unique) {
			this.unique = unique;
		}

		public String getDistinguishedName() {
			return distinguishedName;
		}

		public void setDistinguishedName(String distinguishedName) {
			this.distinguishedName = distinguishedName;
		}

NoSubject's avatar
NoSubject 已提交
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
		public String getPinyin() {
			return pinyin;
		}

		public void setPinyin(String pinyin) {
			this.pinyin = pinyin;
		}

		public String getPinyinInitial() {
			return pinyinInitial;
		}

		public void setPinyinInitial(String pinyinInitial) {
			this.pinyinInitial = pinyinInitial;
		}

R
test  
roo00 已提交
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396
	}

	public Oauth findOauth(String clientId) {
		for (Oauth o : this.getOauths()) {
			if (StringUtils.equalsIgnoreCase(clientId, o.getClientId())) {
				return o;
			}
		}
		return null;
	}

	public Sso findSso(String client) {
		for (Sso o : this.getSsos()) {
			if (StringUtils.equalsIgnoreCase(client, o.getClient())) {
				return o;
			}
		}
		return null;
	}

	public static class Oauth extends ConfigObject {

		public static Oauth defaultInstance() {
Z
zhourui 已提交
397
			return new Oauth();
R
test  
roo00 已提交
398 399 400 401 402
		}

		public Oauth() {
			this.enable = false;
			this.clientId = "";
Z
zhourui 已提交
403
			this.mapping = new LinkedHashMap<>();
NoSubject's avatar
NoSubject 已提交
404

R
test  
roo00 已提交
405 406 407 408 409 410 411 412
		}

		@FieldDescribe("是否启用")
		private Boolean enable;

		@FieldDescribe("客户端名称")
		private String clientId;

NoSubject's avatar
NoSubject 已提交
413 414 415 416 417 418
		@FieldDescribe("密钥")
		private String clientSecret;

		@FieldDescribe("登录地址")
		private String loginUrl;

R
test  
roo00 已提交
419 420 421 422 423 424 425 426 427 428 429 430 431
		@FieldDescribe("返回值")
		private Map<String, String> mapping;

		public String getClientId() {
			return clientId;
		}

		public void setClientId(String clientId) {
			this.clientId = clientId;
		}

		public Map<String, String> getMapping() {
			if (null == mapping) {
Z
zhourui 已提交
432
				return new LinkedHashMap<>();
R
test  
roo00 已提交
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447
			}
			return mapping;
		}

		public void setMapping(Map<String, String> mapping) {
			this.mapping = mapping;
		}

		public Boolean getEnable() {
			return enable;
		}

		public void setEnable(Boolean enable) {
			this.enable = enable;
		}
NoSubject's avatar
NoSubject 已提交
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464

		public String getClientSecret() {
			return clientSecret;
		}

		public void setClientSecret(String clientSecret) {
			this.clientSecret = clientSecret;
		}

		public String getLoginUrl() {
			return loginUrl;
		}

		public void setLoginUrl(String loginUrl) {
			this.loginUrl = loginUrl;
		}

R
test  
roo00 已提交
465 466 467 468 469
	}

	public static class OauthClient extends ConfigObject {

		public static OauthClient defaultInstance() {
Z
zhourui 已提交
470
			return new OauthClient();
R
test  
roo00 已提交
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716
		}

		public static final String default_authParameter = "client_id={$client_id}&redirect_uri={$redirect_uri}";
		public static final String default_infoParameter = "access_token={$access_token}";
		public static final String default_tokenParameter = "client_id={$client_id}&client_secret={$client_secret}&redirect_uri={$redirect_uri}&grant_type=authorization_code&code={$code}";

		public OauthClient() {
			this.enable = false;
			this.name = "";
			this.displayName = "";
			this.icon = "";
			this.clientId = "";
			this.clientSecret = "";
			this.authAddress = "";
			this.authParameter = default_authParameter;
			this.authMethod = "GET";
			this.tokenAddress = "";
			this.tokenParameter = default_tokenParameter;
			this.tokenMethod = "POST";
			this.tokenType = "json";
			this.infoAddress = "";
			this.infoParameter = default_infoParameter;
			this.infoMethod = "GET";
			this.infoType = "json";
			this.infoCredentialField = "openId";
			this.infoScriptText = "";
			this.bindingEnable = false;
			this.bindingField = "";
		}

		@FieldDescribe("是否启用.")
		private Boolean enable = false;
		@FieldDescribe("名称.")
		private String name = "";
		@FieldDescribe("显示名称.")
		private String displayName = "";
		@FieldDescribe("图标.")
		private String icon = "";
		@FieldDescribe("用户oauth2认证的client_id.")
		private String clientId = "";
		@FieldDescribe("用户oauth2认证的client_secret.")
		private String clientSecret = "";
		@FieldDescribe("认证后的跳转地址.")
		private String authAddress = "";
		@FieldDescribe("请求密钥方法参数.")
		private String authParameter = "";
		@FieldDescribe("请求密钥方法.一般为GET")
		private String authMethod = "GET";
		@FieldDescribe("请求令牌网址.")
		private String tokenAddress = "";
		@FieldDescribe("请求令牌方法参数.")
		private String tokenParameter = "";
		@FieldDescribe("请求令牌方法.一般为POST")
		private String tokenMethod = "POST";
		@FieldDescribe("token信息格式.json格式或者form格式")
		private String tokenType = "json";
		@FieldDescribe("请求信息网址.")
		private String infoAddress = "";
		@FieldDescribe("请求信息方法参数.")
		private String infoParameter = "";
		@FieldDescribe("请求信息方法.一般为GET")
		private String infoMethod = "GET";
		@FieldDescribe("info信息格式.json格式或者form格式或者script格式")
		private String infoType = "json";
		@FieldDescribe("info信息中用于标识个人的字段.")
		private String infoCredentialField = "username";
		@FieldDescribe("info信息中用于标识个人的字段.")
		private String infoScriptText = "";
		@FieldDescribe("是否允许绑定到用户,如果允许,用户可以自行绑定.")
		private Boolean bindingEnable = false;
		@FieldDescribe("绑定字段,对端的用户标识,一般为openId绑定到个人字段,可选值为open1Id,open2Id,open3Id,open4Id,open5Id")
		private String bindingField = "";

		public String getDisplayName() {
			return displayName;
		}

		public String getClientId() {
			return clientId;
		}

		public void setClientId(String clientId) {
			this.clientId = clientId;
		}

		public String getClientSecret() {
			return clientSecret;
		}

		public void setClientSecret(String clientSecret) {
			this.clientSecret = clientSecret;
		}

		public String getAuthAddress() {
			return authAddress;
		}

		public void setAuthAddress(String authAddress) {
			this.authAddress = authAddress;
		}

		public String getTokenAddress() {
			return tokenAddress;
		}

		public void setTokenAddress(String tokenAddress) {
			this.tokenAddress = tokenAddress;
		}

		public String getInfoAddress() {
			return infoAddress;
		}

		public void setInfoAddress(String infoAddress) {
			this.infoAddress = infoAddress;
		}

		public Boolean getEnable() {
			return enable;
		}

		public void setEnable(Boolean enable) {
			this.enable = enable;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public String getAuthMethod() {
			return authMethod;
		}

		public void setAuthMethod(String authMethod) {
			this.authMethod = authMethod;
		}

		public String getTokenMethod() {
			return tokenMethod;
		}

		public void setTokenMethod(String tokenMethod) {
			this.tokenMethod = tokenMethod;
		}

		public String getInfoMethod() {
			return infoMethod;
		}

		public void setInfoMethod(String infoMethod) {
			this.infoMethod = infoMethod;
		}

		public String getInfoType() {
			return infoType;
		}

		public void setInfoType(String infoType) {
			this.infoType = infoType;
		}

		public String getInfoCredentialField() {
			return infoCredentialField;
		}

		public void setInfoCredentialField(String infoCredentialField) {
			this.infoCredentialField = infoCredentialField;
		}

		public String getAuthParameter() {
			return authParameter;
		}

		public void setAuthParameter(String authParameter) {
			this.authParameter = authParameter;
		}

		public String getTokenParameter() {
			return tokenParameter;
		}

		public void setTokenParameter(String tokenParameter) {
			this.tokenParameter = tokenParameter;
		}

		public String getInfoParameter() {
			return infoParameter;
		}

		public void setInfoParameter(String infoParameter) {
			this.infoParameter = infoParameter;
		}

		public String getTokenType() {
			return tokenType;
		}

		public void setTokenType(String tokenType) {
			this.tokenType = tokenType;
		}

		public String getIcon() {
			return icon;
		}

		public void setIcon(String icon) {
			this.icon = icon;
		}

		public String getInfoScriptText() {
			return infoScriptText;
		}

		public void setInfoScriptText(String infoScriptText) {
			this.infoScriptText = infoScriptText;
		}

		public Boolean getBindingEnable() {
			return bindingEnable;
		}

		public void setBindingEnable(Boolean bindingEnable) {
			this.bindingEnable = bindingEnable;
		}

		public String getBindingField() {
			return bindingField;
		}

		public void setBindingField(String bindingField) {
			this.bindingField = bindingField;
		}

		public void setDisplayName(String displayName) {
			this.displayName = displayName;
		}

	}

	public static class Sso extends ConfigObject {

		public static Sso defaultInstance() {
Z
zhourui 已提交
717
			return new Sso();
R
test  
roo00 已提交
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752
		}

		public Sso() {
			this.enable = false;
			this.client = "";
			this.key = "";
		}

		@FieldDescribe("是否启用")
		private Boolean enable;

		@FieldDescribe("名称")
		private String client;

		@FieldDescribe("密钥")
		private String key;

		public String getClient() {
			return client;
		}

		public void setClient(String client) {
			this.client = client;
		}

		public String getKey() {
			return key;
		}

		public void setKey(String key) {
			this.key = key;
		}

	}

O
o2sword 已提交
753 754 755
	public static class LdapAuth extends ConfigObject {

		public static LdapAuth defaultInstance() {
Z
zhourui 已提交
756
			return new LdapAuth();
O
o2sword 已提交
757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810
		}

		public LdapAuth() {
			this.enable = false;
			this.ldapUrl = "";
			this.baseDn = "";
			this.userDn = "";
		}

		@FieldDescribe("是否启用")
		private Boolean enable;

		@FieldDescribe("LDAP地址")
		private String ldapUrl;

		@FieldDescribe("LDAP查询的根名称如:dc=zone,DC=COM")
		private String baseDn;

		@FieldDescribe("认证用户的DN如:uid=*,ou=users,dc=zone,DC=COM,其中uid=*中的*表示用户的唯一编码,此唯一编码与O2用户的唯一编码对应")
		private String userDn;

		public Boolean getEnable() {
			return enable;
		}

		public void setEnable(Boolean enable) {
			this.enable = enable;
		}

		public String getLdapUrl() {
			return ldapUrl;
		}

		public void setLdapUrl(String ldapUrl) {
			this.ldapUrl = ldapUrl;
		}

		public String getBaseDn() {
			return baseDn;
		}

		public void setBaseDn(String baseDn) {
			this.baseDn = baseDn;
		}

		public String getUserDn() {
			return userDn;
		}

		public void setUserDn(String userDn) {
			this.userDn = userDn;
		}
	}

R
test  
roo00 已提交
811 812 813 814 815 816 817 818
	public List<OauthClient> getOauthClients() {
		return oauthClients;
	}

	public void setOauthClients(List<OauthClient> oauthClients) {
		this.oauthClients = oauthClients;
	}

O
o2sword 已提交
819
}