|
| 1 | +/* |
| 2 | + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. |
| 3 | + * |
| 4 | + * U.S. Government Rights - Commercial software. Government users |
| 5 | + * are subject to the Sun Microsystems, Inc. standard license agreement |
| 6 | + * and applicable provisions of the FAR and its supplements. |
| 7 | + * |
| 8 | + * Use is subject to license terms. |
| 9 | + * |
| 10 | + * This distribution may include materials developed by third parties. |
| 11 | + * Sun, Sun Microsystems, the Sun logo, Java and Project Identity |
| 12 | + * Connectors are trademarks or registered trademarks of Sun |
| 13 | + * Microsystems, Inc. or its subsidiaries in the U.S. and other |
| 14 | + * countries. |
| 15 | + * |
| 16 | + * UNIX is a registered trademark in the U.S. and other countries, |
| 17 | + * exclusively licensed through X/Open Company, Ltd. |
| 18 | + * |
| 19 | + * ----------- |
| 20 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
| 21 | + * |
| 22 | + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. |
| 23 | + * |
| 24 | + * The contents of this file are subject to the terms of the Common Development |
| 25 | + * and Distribution License(CDDL) (the License). You may not use this file |
| 26 | + * except in compliance with the License. |
| 27 | + * |
| 28 | + * You can obtain a copy of the License at |
| 29 | + * http://identityconnectors.dev.java.net/CDDLv1.0.html |
| 30 | + * See the License for the specific language governing permissions and |
| 31 | + * limitations under the License. |
| 32 | + * |
| 33 | + * When distributing the Covered Code, include this CDDL Header Notice in each |
| 34 | + * file and include the License file at identityconnectors/legal/license.txt. |
| 35 | + * If applicable, add the following below this CDDL Header, with the fields |
| 36 | + * enclosed by brackets [] replaced by your own identifying information: |
| 37 | + * "Portions Copyrighted [year] [name of copyright owner]" |
| 38 | + * ----------- |
| 39 | + */ |
| 40 | +using System; |
| 41 | +using System.Collections.Generic; |
| 42 | +using System.Text; |
| 43 | +using System.Diagnostics; |
| 44 | +using Org.IdentityConnectors.Framework.Spi; |
| 45 | +using Org.IdentityConnectors.Framework.Common.Exceptions; |
| 46 | + |
| 47 | +namespace Org.IdentityConnectors.ActiveDirectory |
| 48 | +{ |
| 49 | + public class ActiveDirectoryConfiguration : Org.IdentityConnectors.Framework.Spi.AbstractConfiguration |
| 50 | + { |
| 51 | + [ConfigurationProperty(Confidential = false, DisplayMessageKey = "display_SyncGlobalCatalogServer", HelpMessageKey = "help_SyncGlobalCatalogServer")] |
| 52 | + public String SyncGlobalCatalogServer |
| 53 | + { get; set; } |
| 54 | + |
| 55 | + [ConfigurationProperty(Confidential = false, DisplayMessageKey = "display_SyncDomainController", HelpMessageKey = "help_SyncDomainController")] |
| 56 | + public String SyncDomainController |
| 57 | + { get; set; } |
| 58 | + |
| 59 | + [ConfigurationProperty(Confidential = false, DisplayMessageKey = "display_SyncSearchContext", HelpMessageKey = "help_SyncSearchContext")] |
| 60 | + public String SyncSearchContext |
| 61 | + { get; set; } |
| 62 | + |
| 63 | + [ConfigurationProperty(Confidential = false, DisplayMessageKey = "display_domainName", HelpMessageKey = "help_domainName")] |
| 64 | + public String DomainName |
| 65 | + { get; set; } |
| 66 | + |
| 67 | + [ConfigurationProperty(Confidential = false, DisplayMessageKey = "display.DirectoryAdminName", HelpMessageKey = "help.DirectoryAdminName")] |
| 68 | + public String DirectoryAdminName |
| 69 | + { get; set; } |
| 70 | + |
| 71 | + [ConfigurationProperty(Confidential = true, DisplayMessageKey = "display.DirectoryAdminPassword", HelpMessageKey = "help.DirectoryAdminPassword")] |
| 72 | + public String DirectoryAdminPassword |
| 73 | + { get; set; } |
| 74 | + |
| 75 | + [ConfigurationProperty(Confidential = false, DisplayMessageKey = "display.ObjectClass", HelpMessageKey = "help.ObjectClass")] |
| 76 | + public String ObjectClass |
| 77 | + { get; set; } |
| 78 | + |
| 79 | + [ConfigurationProperty(Confidential = false, DisplayMessageKey = "display.UserProvidesPasswordOnChange", HelpMessageKey = "help.UserProvidesPasswordOnChange")] |
| 80 | + public bool UserProvidesPasswordOnChange{get;set;} |
| 81 | + |
| 82 | + [ConfigurationProperty(Confidential = false, DisplayMessageKey = "display.CreateHomeDirectory", HelpMessageKey = "help.CreateHomeDirectory")] |
| 83 | + public bool CreateHomeDirectory { get; set; } |
| 84 | + |
| 85 | + [ConfigurationProperty(Confidential = false, DisplayMessageKey = "display.SearchContext", HelpMessageKey = "help.SearchContext")] |
| 86 | + public String SearchContext |
| 87 | + { get; set; } |
| 88 | + |
| 89 | + [ConfigurationProperty(Confidential = false, DisplayMessageKey = "display.SearchChildDomains", HelpMessageKey = "help.SearchChildDomains")] |
| 90 | + public bool SearchChildDomains {get;set;} |
| 91 | + |
| 92 | + [ConfigurationProperty(Confidential = false, DisplayMessageKey = "display.EncryptionType", HelpMessageKey = "help.EncryptionType")] |
| 93 | + public String EncryptionType |
| 94 | + { get; set; } |
| 95 | + |
| 96 | + [ConfigurationProperty(Confidential = false, DisplayMessageKey = "display.LDAPHostName", HelpMessageKey = "help.LDAPHostName")] |
| 97 | + public String LDAPHostName |
| 98 | + { get; set; } |
| 99 | + |
| 100 | + public ActiveDirectoryConfiguration() |
| 101 | + { |
| 102 | + DomainName = ""; |
| 103 | + SearchContext = ""; |
| 104 | + DirectoryAdminName = "cn=DirectoryAdmin"; |
| 105 | + ObjectClass = "User"; |
| 106 | + UserProvidesPasswordOnChange = false; |
| 107 | + CreateHomeDirectory = false; |
| 108 | + SearchChildDomains = false; |
| 109 | + EncryptionType = "NONE"; |
| 110 | + LDAPHostName = ""; |
| 111 | + } |
| 112 | + |
| 113 | + public override void Validate() |
| 114 | + { |
| 115 | + String message = "Configuration errors: "; |
| 116 | + Boolean foundError = false; |
| 117 | + |
| 118 | + // can't lookup the schema without the domain name |
| 119 | + if (DomainName.Length == 0) |
| 120 | + { |
| 121 | + message += "->Domain name not supplied "; |
| 122 | + foundError = true; |
| 123 | + } |
| 124 | + |
| 125 | + if (DirectoryAdminName.Length == 0) |
| 126 | + { |
| 127 | + message += "->Directory administrator name not supplied "; |
| 128 | + foundError = true; |
| 129 | + } |
| 130 | + |
| 131 | + if (ObjectClass.Length == 0) |
| 132 | + { |
| 133 | + message += "->ObjectClass was not supplied "; |
| 134 | + foundError = true; |
| 135 | + } |
| 136 | + |
| 137 | + if (foundError) |
| 138 | + { |
| 139 | + throw new ConfigurationException(message); |
| 140 | + } |
| 141 | + } |
| 142 | + } |
| 143 | +} |
0 commit comments