<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
<div id="content-area" class="col-sm-9" role="main">
    <data-kc-navigation data-kc-current="ldap" data-kc-realm="realm.realm" data-kc-social="realm.social"></data-kc-navigation>
    <div id="content">
        <ol class="breadcrumb">
            <li><a href="#/realms/{{realm.realm}}">{{realm.realm}}</a></li>
            <li><a href="#/realms/{{realm.realm}}">Settings</a></li>
            <li class="active">Ldap Configuration</li>
        </ol>
        <h2 class="pull-left"><span>{{realm.realm}}</span> Ldap Server Settings</h2>
        <p class="subtitle"><span class="required">*</span> Required fields</p>
        <form class="form-horizontal" name="realmForm" novalidate kc-read-only="!access.manageRealm">
            
            <fieldset>
                <legend><span class="text">Required Settings</span></legend>
                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="vendor">Vendor <span class="required">*</span></label>
                    <div class="col-sm-4">
                        <div class="select-kc">
                            <select id="vendor"
                                    ng-model="realm.ldapServer.vendor"
                                    ng-options="vendor.id as vendor.name for vendor in ldapVendors">
                            </select>
                        </div>
                    </div>
                </div>
                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="usernameLDAPAttribute">Username LDAP attribute <span class="required">*</span></label>
                    <div class="col-sm-4">
                        <div class="select-kc">
                            <select id="usernameLDAPAttribute"
                                    ng-model="realm.ldapServer.usernameLDAPAttribute"
                                    ng-options="usernameLDAPAttribute for usernameLDAPAttribute in usernameLDAPAttributes">
                            </select>
                        </div>
                    </div>
                </div>
                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="userObjectClasses">User Object Classes <span class="required">*</span></label>
                    <div class="col-sm-4">
                        <input class="form-control" id="userObjectClasses" type="text" ng-model="realm.ldapServer.userObjectClasses" placeholder="LDAP User Object Classes (div. by comma)" required>
                    </div>
                </div>
                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="ldapConnectionUrl">Connection URL <span class="required">*</span></label>
                    <div class="col-sm-4">
                        <input class="form-control" id="ldapConnectionUrl" type="text" ng-model="realm.ldapServer.connectionUrl" placeholder="LDAP connection URL" required>
                    </div>
                    <div class="col-sm-4" data-ng-show="access.manageRealm">
                        <a class="btn btn-primary" data-ng-click="testConnection()">Test connection</a>
                    </div>
                </div>
                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="ldapBaseDn">Base DN <span class="required">*</span></label>
                    <div class="col-sm-4">
                        <input class="form-control" id="ldapBaseDn" type="text" ng-model="realm.ldapServer.baseDn" placeholder="LDAP Base DN" required>
                    </div>
                </div>
                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="ldapUserDnSuffix">User DN Suffix <span class="required">*</span></label>
                    <div class="col-sm-4">
                        <input class="form-control" id="ldapUserDnSuffix" type="text" ng-model="realm.ldapServer.userDnSuffix" placeholder="LDAP User DN Suffix" required>
                    </div>
                </div>
                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="ldapBindDn">Bind DN <span class="required">*</span></label>
                    <div class="col-sm-4">
                        <input class="form-control" id="ldapBindDn" type="text" ng-model="realm.ldapServer.bindDn" placeholder="LDAP Bind DN" required>
                    </div>
                </div>
                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="ldapBindCredential">Bind Credential <span class="required">*</span></label>
                    <div class="col-sm-4">
                        <input class="form-control" id="ldapBindCredential" type="text" ng-model="realm.ldapServer.bindCredential" placeholder="LDAP Bind Credentials" required>
                    </div>
                    <div class="col-sm-4" data-ng-show="access.manageRealm">
                        <a class="btn btn-primary" data-ng-click="testAuthentication()">Test authentication</a>
                    </div>
                </div>
            </fieldset>

            <div class="pull-right form-actions" data-ng-show="access.manageRealm">
                <button data-kc-reset data-ng-show="changed">Clear changes</button>
                <button data-kc-save data-ng-show="changed">Save</button>
            </div>
        </form>
    </div>
</div>