<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/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" data-ng-hide="create">
            <li><a href="#/realms/{{realm.realm}}/user-federation">Federation Providers</a></li>
            <li><a href="#/realms/{{realm.realm}}/user-federation/providers/{{instance.providerName}}/{{instance.id}}">{{instance.displayName}}</a></li>
            <li class="active">Kerberos Settings</li>
        </ol>
        <ol class="breadcrumb" data-ng-show="create">
            <li><a href="#/realms/{{realm.realm}}/user-federation">Federation Providers</a></li>
            <li class="active">Add Kerberos Provider</li>
        </ol>
        <h2 class="pull-left" data-ng-hide="create">Kerberos Provider Settings <span tooltip-placement="right" tooltip="Use Kerberos federation provider just if you don't need Kerberos integrated with LDAP! For Kerberos+LDAP use LDAP Federation provider instead"
                                                                                     class="fa fa-info-circle"></span></h2>
        <h2 class="pull-left" data-ng-show="create">Add Standalone Kerberos Provider <span tooltip-placement="right" tooltip="Use Kerberos federation provider just if you don't need Kerberos integrated with LDAP! For Kerberos+LDAP use LDAP Federation provider instead"
                                                                                           class="fa fa-info-circle"></span></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" data-ng-show="!create">
                    <label class="col-sm-2 control-label" for="providerId">Provider ID </label>
                    <div class="col-sm-4">
                        <input class="form-control" id="providerId" type="text" ng-model="instance.id" readonly>
                    </div>
                </div>
                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="consoleDisplayName">Console display name </label>
                    <div class="col-sm-4">
                        <input class="form-control" id="consoleDisplayName" type="text" ng-model="instance.displayName" placeholder="defaults to id">
                    </div>
                    <span tooltip-placement="right" tooltip="Display name of provider when linked in admin console." class="fa fa-info-circle"></span>
                </div>
                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="priority">Priority </label>
                    <div class="col-sm-4">
                        <input class="form-control" id="priority" type="text" ng-model="instance.priority">
                    </div>
                    <span tooltip-placement="right" tooltip="Priority of provider when doing a user lookup.  Lowest first." class="fa fa-info-circle"></span>
                </div>

                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="kerberosRealm">Kerberos Realm <span class="required">*</span></label>
                    <div class="col-sm-4">
                        <input class="form-control" id="kerberosRealm" type="text" ng-model="instance.config.kerberosRealm" required>
                    </div>
                    <span tooltip-placement="right" tooltip="Name of kerberos realm. For example FOO.ORG" class="fa fa-info-circle"></span>
                </div>
                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="serverPrincipal">Server principal <span class="required">*</span></label>
                    <div class="col-sm-4">
                        <input class="form-control" id="serverPrincipal" type="text" ng-model="instance.config.serverPrincipal" required>
                    </div>
                    <span tooltip-placement="right" tooltip="Full name of server principal for HTTP service including server and domain name. For example HTTP/host.foo.org@FOO.ORG" class="fa fa-info-circle"></span>
                </div>
                <div class="form-group clearfix">
                    <label class="col-sm-2 control-label" for="keyTab">KeyTab <span class="required">*</span></label>
                    <div class="col-sm-4">
                        <input class="form-control" id="keyTab" type="text" ng-model="instance.config.keyTab" required>
                    </div>
                    <span tooltip-placement="right" tooltip="Location of Kerberos KeyTab file containing the credentials of server principal. For example /etc/krb5.keytab" class="fa fa-info-circle"></span>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="debug">Debug </label>
                    <div class="col-sm-4">
                        <input ng-model="instance.config.debug" id="debug" onoffswitch />
                    </div>
                    <span tooltip-placement="right" tooltip="Enable/disable debug logging to standard output for Krb5LoginModule." class="fa fa-info-circle"></span>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="allowPasswordAuthentication">Allow Password Authentication </label>
                    <div class="col-sm-4">
                        <input ng-model="instance.config.allowPasswordAuthentication" id="allowPasswordAuthentication" onoffswitch />
                    </div>
                    <span tooltip-placement="right" tooltip="Enable/disable possibility of username/password authentication against Kerberos database" class="fa fa-info-circle"></span>
                </div>
                <div class="form-group" data-ng-show="instance.config.allowPasswordAuthentication">
                    <label class="col-sm-2 control-label" for="editMode">Edit mode</label>
                    <div class="col-sm-4">
                        <div class="select-kc">
                            <select id="editMode"
                                    ng-model="instance.config.editMode">
                                <option>READ_ONLY</option>
                                <option>UNSYNCED</option>
                            </select>
                        </div>
                    </div>
                    <span tooltip-placement="right" tooltip="READ_ONLY means that password updates are not allowed and user always authenticates with Kerberos password. UNSYNCED means user can change his password in Keycloak database and this one will be used instead of Kerberos password then" class="fa fa-info-circle"></span>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="updateProfileFirstLogin">Update Profile First Login </label>
                    <div class="col-sm-4">
                        <input ng-model="instance.config.updateProfileFirstLogin" id="updateProfileFirstLogin" onoffswitch />
                    </div>
                    <span tooltip-placement="right" tooltip="Update profile on first login" class="fa fa-info-circle"></span>
                </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>