001/* 002 * (C) Copyright 2006-2008 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 * 019 * $Id$ 020 */ 021 022package org.nuxeo.ecm.platform.oauth.tokens; 023 024import java.util.Calendar; 025 026import org.nuxeo.ecm.platform.oauth.consumers.OAuthConsumerRegistry; 027 028/** 029 * Represents Token data as manipulated in OAuth during the 3 legged authentication. The same interface is used for 030 * Request Token and Access Token. 031 * 032 * @author tiry 033 */ 034public interface OAuthToken { 035 036 enum Type { 037 REQUEST, ACCESS 038 } 039 040 /** 041 * Returns consumer application identifier. 042 */ 043 String getAppId(); 044 045 /** 046 * Returns consumer call back url (may be used to override what is provided in the {@link OAuthConsumerRegistry}. 047 */ 048 String getCallbackUrl(); 049 050 /** 051 * Returns Nuxeo Login as determined during the authorize phase. 052 */ 053 String getNuxeoLogin(); 054 055 /** 056 * Returns OAuth token. 057 */ 058 String getToken(); 059 060 /** 061 * Returns secret associated to the Token. 062 */ 063 String getTokenSecret(); 064 065 /** 066 * Gets the Consumer Key. 067 */ 068 String getConsumerKey(); 069 070 /** 071 * Gets the type of token: REQUEST / ACCESS. 072 */ 073 Type getType(); 074 075 /** 076 * Gets creation date of the Token. 077 */ 078 Calendar getCreationDate(); 079 080 /** 081 * Generic getter (not used for now). 082 */ 083 String getValue(String keyName); 084 085 /** 086 * Generic setter (not used for now). 087 */ 088 void setValue(String keyName, String value); 089 090 /** 091 * Gets the verifier code. 092 */ 093 String getVerifier(); 094 095 /** 096 * Checks is token is expired. 097 */ 098 boolean isExpired(); 099 100 /** 101 * Setter for the Login. 102 */ 103 void setNuxeoLogin(String login); 104 105}