001/*
002 * (C) Copyright 2010 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Nuxeo - initial API and implementation
016 */
017package org.nuxeo.ecm.platform.oauth.keys;
018
019import java.io.Serializable;
020
021import org.nuxeo.common.xmap.annotation.XNode;
022import org.nuxeo.common.xmap.annotation.XObject;
023
024/**
025 * Xmap object used to represent the contribution to {@link OAuthServerKeyManager}. => contribute a simple RSA Key Pair.
026 *
027 * @author tiry
028 */
029@XObject("serverKeyPair")
030public class ServerKeyDescriptor implements Serializable {
031
032    private static final long serialVersionUID = 1L;
033
034    @XNode("privateKey")
035    protected String externalPrivateKey;
036
037    /**
038     * Most folks should not need to change this from the default value of nuxeo. It's unclear that there are many
039     * service providers that actually use this value.
040     */
041    @XNode("privateKeyName")
042    protected String externalPrivateKeyName;
043
044    /**
045     * This is here just for convenience of keeping everything together. This is the public key (really a certificate)
046     * that you need to give to external oauth provider to indicate that you have the private key above. Assuming you
047     * generated the key with the lines above, you should be able to simply paste the "certificate" portion of the
048     * testkey.pem file into this field. It is not used by nuxeo in any way, but <b>will</b> be needed when you
049     * configure an external provider.
050     * <p>
051     * Note that many providers accept the certificate then run a computation to extract the public key from it. This
052     * means that the value displayed when you look at the provider configuration may be different than the one you
053     * provided.
054     */
055    @XNode("publicCertificate")
056    protected String externalPublicCertificate;
057
058}