001/*
002 * (C) Copyright 2010 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 */
019package org.nuxeo.ecm.platform.oauth.keys;
020
021import java.io.Serializable;
022
023import org.nuxeo.common.xmap.annotation.XNode;
024import org.nuxeo.common.xmap.annotation.XObject;
025
026/**
027 * Xmap object used to represent the contribution to {@link OAuthServerKeyManager}. => contribute a simple RSA Key Pair.
028 *
029 * @author tiry
030 */
031@XObject("serverKeyPair")
032public class ServerKeyDescriptor implements Serializable {
033
034    private static final long serialVersionUID = 1L;
035
036    @XNode("privateKey")
037    protected String externalPrivateKey;
038
039    /**
040     * Most folks should not need to change this from the default value of nuxeo. It's unclear that there are many
041     * service providers that actually use this value.
042     */
043    @XNode("privateKeyName")
044    protected String externalPrivateKeyName;
045
046    /**
047     * This is here just for convenience of keeping everything together. This is the public key (really a certificate)
048     * that you need to give to external oauth provider to indicate that you have the private key above. Assuming you
049     * generated the key with the lines above, you should be able to simply paste the "certificate" portion of the
050     * testkey.pem file into this field. It is not used by nuxeo in any way, but <b>will</b> be needed when you
051     * configure an external provider.
052     * <p>
053     * Note that many providers accept the certificate then run a computation to extract the public key from it. This
054     * means that the value displayed when you look at the provider configuration may be different than the one you
055     * provided.
056     */
057    @XNode("publicCertificate")
058    protected String externalPublicCertificate;
059
060}