<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">
    <ul class="nav nav-tabs nav-tabs-pf">
        <li><a href="#/realms/{{realm.realm}}/users">User List</a></li>
        <li><a href="#/realms/{{realm.realm}}/user-federation">Federation</a></li>
    </ul>
    <div id="content">
        <ol class="breadcrumb">
            <li><a href="#/realms/{{realm.realm}}/user-federation">Federation</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</label>
                    <div class="col-sm-4">
                        <div class="select-kc">
                            <select id="vendor"
                                    ng-model="provider.config.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 </label>
                    <div class="col-sm-4">
                        <div class="select-kc">
                            <select id="usernameLDAPAttribute"
                                    ng-model="provider.config.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 </label>
                    <div class="col-sm-4">
                        <input class="form-control" id="userObjectClasses" type="text" ng-model="provider.config.userObjectClasses" placeholder="LDAP User Object Classes (div. by comma)">
                    </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="provider.config.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="provider.config.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="provider.config.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="provider.config.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="provider.config.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="create && access.manageUsers">
                <button kc-cancel data-ng-click="cancel()">Cancel</button>
                <button kc-save data-ng-show="changed">Save</button>
            </div>

            <div class="pull-right form-actions" data-ng-show="!create && access.manageUsers">
                <button kc-reset data-ng-show="changed">Clear changes</button>
                <button kc-save  data-ng-show="changed">Save</button>
                <button kc-delete data-ng-click="remove()" data-ng-hide="changed">Delete</button>
            </div>
        </form>
    </div>
</div>