<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->

<!-- $Rev: 545781 $ $Date: 2007-06-10 01:44:02 +0800 (Sun, 10 Jun 2007) $ -->

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:cs="http://geronimo.apache.org/xml/ns/credentialstore-1.0"
            targetNamespace="http://geronimo.apache.org/xml/ns/credentialstore-1.0"
            elementFormDefault="qualified" attributeFormDefault="unqualified"
            version="1.0">

    <xsd:annotation>
        <xsd:documentation>
            This is an XML Schema Definition for credential store configuration.
            CredentialStore configuration is
            specified by the element credential-store with namespace
            specified as xmlns =
            "http://geronimo.apache.org/xml/ns/credentialstore-1.0".
        </xsd:documentation>
    </xsd:annotation>

    <xsd:element name="credential-store" type="cs:credential-storeType">
        <xsd:annotation>
            <xsd:documentation>
                The root element for Geronimo credential store configuration. This
                is a tree structure of realm, id, and sets of credentials such as name and password
            </xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:complexType name="credential-storeType">
        <xsd:annotation>
            <xsd:documentation>
                Defines the list of realms
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="realm" type="cs:realmType" minOccurs="0" maxOccurs="unbounded">
                <xsd:annotation>
                    <xsd:documentation>
                        The realm element contains the credentials for subjects in that realm.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="realmType">
        <xsd:sequence>
            <xsd:element name="subject" type="cs:subjectType" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="name" type="xsd:string" use="required">
            <xsd:annotation>
                <xsd:documentation>
                    The name attribute specifies the login realm name
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
    </xsd:complexType>

    <xsd:complexType name="subjectType">
        <xsd:sequence>
            <xsd:element name="id" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        The id element serves to identify the subject externally. For subjects with meaningful
                        names it might be convenient to use the name as id.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="credential" type="cs:credentialType" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="credentialType">
        <xsd:sequence>
            <xsd:element name="type" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        Class name or alias of the callback handler that will accept this credential
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="value" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        credential value as a string.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>


</xsd:schema>
