1 /** 2 * Copyright (C) 2005-2009 Alfresco Software Limited. 3 * 4 * This file is part of the Spring Surf Extension project. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package org.springframework.extensions.webscripts.connector; 20 21 /** 22 * Interface that describes the credentials for a given service 23 * or user. 24 * 25 * @author muzquiano 26 */ 27 public interface Credentials 28 { 29 public final static String CREDENTIAL_USERNAME = "cleartextUsername"; 30 public final static String CREDENTIAL_PASSWORD = "cleartextPassword"; 31 32 /** 33 * Gets the endpoint id. 34 * 35 * @return the endpoint id 36 */ 37 public String getEndpointId(); 38 39 /** 40 * Gets a given property 41 * 42 * @param key the key 43 * 44 * @return the property 45 */ 46 public Object getProperty(String key); 47 48 /** 49 * Sets a given property 50 * 51 * @param key the key 52 * @param value the value 53 */ 54 public void setProperty(String key, Object value); 55 56 /** 57 * Removes a given property 58 * 59 * @param key 60 */ 61 public void removeProperty(String key); 62 63 /** 64 * Removes all properties 65 * 66 * @param key 67 */ 68 public void removeAllProperties(String key); 69 70 /** 71 * Returns the property keys 72 * 73 * @return array of property keys 74 */ 75 public String[] getPropertyKeys(); 76 77 /** 78 * Returns whether this credential is persistent 79 * 80 * A persistent credential is written to a persistent vault. 81 * A non-persistent credential is loaded into the vault but never stored 82 * 83 * @return 84 */ 85 public boolean isPersistent(); 86 }