001/* 002 * (C) Copyright 2011 Nuxeo SA (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 * Wojciech Sulejman 016 */ 017package org.nuxeo.ecm.platform.signature.api.user; 018 019/** 020 * Represents a keystore alias. 021 * <p> 022 * Provides methods for binding a keystore alias name with userID and alias type. 023 * 024 * @author <a href="mailto:ws@nuxeo.com">Wojciech Sulejman</a> 025 */ 026public class AliasWrapper { 027 private String userName; 028 029 /** 030 * Public constructor for the AliasWrapper. Used to associate a user name with an AliasWrapper object. The userName 031 * constitutes the first part of the AliasWrapper's identity. The second part of the identity is based on an 032 * AliasType provided as a parameter. E.g., for a user identified by string "jdoe" and using a type "cert", the 033 * produced alias string would be "jdoecert". 034 * 035 * @param userName 036 */ 037 public AliasWrapper(String userName) { 038 this.userName = userName; 039 } 040 041 /** 042 * Provides the user name associated with the alias for generic checking of alias groups (an alias group would share 043 * the name, not the id). 044 * 045 * @return 046 */ 047 public String getUserName() { 048 return userName; 049 } 050 051 /** 052 * Returns a unique identifier for the keystore alias. 053 */ 054 public String getId(AliasType type) { 055 return userName + type.toString(); 056 } 057}