<div class="col-sm-9 col-md-10 col-sm-push-3 col-md-push-2">
    <ol class="breadcrumb">
        <li><a href="#/realms/{{realm.realm}}/user-federation">User Federation</a></li>
        <li data-ng-hide="create">{{instance.displayName|capitalize}}</li>
        <li data-ng-show="create">Add User Federation Provider</li>
    </ol>

    <h1 data-ng-hide="create">Kerberos</h1>
    <h1 data-ng-show="create">Add Kerberos User Federation Provider</h1>

    <ul class="nav nav-tabs" data-ng-hide="create">
        <li class="active"><a href="#/realms/{{realm.realm}}/user-federation/providers/{{instance.providerName}}/{{instance.id}}">Settings</a></li>
        <li><a href="#/realms/{{realm.realm}}/user-federation/providers/{{instance.providerName}}/{{instance.id}}/mappers">Mappers</a></li>
    </ul>

    <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-md-2 control-label" for="providerId">Provider ID </label>
                <div class="col-md-6">
                    <input class="form-control" id="providerId" type="text" ng-model="instance.id" readonly>
                </div>
            </div>
            <div class="form-group clearfix">
                <label class="col-md-2 control-label" for="consoleDisplayName">Console display name </label>
                <div class="col-md-6">
                    <input class="form-control" id="consoleDisplayName" type="text" ng-model="instance.displayName" placeholder="defaults to id">
                </div>
                <kc-tooltip>Display name of provider when linked in admin console.</kc-tooltip>
            </div>
            <div class="form-group clearfix">
                <label class="col-md-2 control-label" for="priority">Priority </label>
                <div class="col-md-6">
                    <input class="form-control" id="priority" type="text" ng-model="instance.priority">
                </div>
                <kc-tooltip>Priority of provider when doing a user lookup.  Lowest first.</kc-tooltip>
            </div>

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

            <div class="form-group">
                <label class="col-md-2 control-label" for="allowPasswordAuthentication">Allow Password Authentication </label>
                <div class="col-md-6">
                    <input ng-model="instance.config.allowPasswordAuthentication" id="allowPasswordAuthentication" onoffswitch />
                </div>
                <kc-tooltip>Enable/disable possibility of username/password authentication against Kerberos database</kc-tooltip>
            </div>
            <div class="form-group" data-ng-show="instance.config.allowPasswordAuthentication">
                <label class="col-md-2 control-label" for="editMode">Edit mode</label>
                <div class="col-md-6">
                    <div>
                        <select class="form-control" id="editMode"
                                ng-model="instance.config.editMode">
                            <option>READ_ONLY</option>
                            <option>UNSYNCED</option>
                        </select>
                    </div>
                </div>
                <kc-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</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label" for="updateProfileFirstLogin">Update Profile First Login </label>
                <div class="col-md-6">
                    <input ng-model="instance.config.updateProfileFirstLogin" id="updateProfileFirstLogin" onoffswitch />
                </div>
                <kc-tooltip>Update profile on first login</kc-tooltip>
            </div>

        </fieldset>

        <div class="form-group">
            <div class="col-md-10 col-md-offset-2" data-ng-show="create && access.manageUsers">
                <button kc-save>Save</button>
                <button kc-cancel data-ng-click="cancel()">Cancel</button>
            </div>
        </div>

        <div class="form-group">
            <div class="col-md-10 col-md-offset-2" data-ng-show="!create && access.manageUsers">
                <button kc-save  data-ng-show="changed">Save</button>
                <button kc-reset data-ng-show="changed">Cancel</button>
                <button kc-delete data-ng-click="remove()" data-ng-hide="changed">Delete</button>
            </div>
        </div>
    </form>
</div>

<kc-menu></kc-menu>