001/** 002 * Copyright 2015 Tampere University of Technology, Pori Department 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 */ 016package service.tut.pori.users.google; 017 018/** 019 * Definitions for users/google package. 020 * 021 */ 022public final class Definitions { 023 024 /* JSON definitions */ 025 /** JSON name/object declaration */ 026 public static final String JSON_NAME_OAUTH2_ACCESS_TOKEN = "access_token"; 027 /** JSON name/object declaration */ 028 public static final String JSON_NAME_OAUTH2_EXPIRES_IN = "expires_in"; 029 /** JSON name/object declaration */ 030 public static final String JSON_NAME_OAUTH2_REFRESH_TOKEN = "refresh_token"; 031 /** JSON name/object declaration */ 032 public static final String JSON_NAME_OAUTH2_TOKEN_TYPE = "token_type"; 033 034 /* local methods */ 035 /** local service method declaration */ 036 public static final String METHOD_LOGIN = "login"; 037 /** local service method declaration */ 038 public static final String METHOD_OAUTH2_AUTHORIZATION_REDIRECT = "authorize"; 039 /** local service method declaration */ 040 public static final String METHOD_OAUTH2_CALLBACK = "oAuth2callback"; 041 /** local service method declaration */ 042 public static final String METHOD_UNAUTHORIZE = "unauthorize"; 043 044 /* remote methods */ 045 /** remote service method declaration */ 046 public static final String METHOD_GOOGLE_AUTH = "auth"; 047 /** remote service method declaration */ 048 public static final String METHOD_GOOGLE_REVOKE = "revoke"; 049 /** remote service method declaration */ 050 public static final String METHOD_GOOGLE_TOKEN = "token"; 051 /** remote service method declaration */ 052 public static final String METHOD_GOOGLE_USER_INFO = "userinfo"; 053 054 /* parameters */ 055 /** method parameter declaration */ 056 public static final String PARAMETER_GOOGLE_ACCESS_TYPE = "access_type"; 057 /** method parameter declaration */ 058 public static final String PARAMETER_GOOGLE_APPROVAL_PROMPT = "approval_prompt"; 059 /** method parameter declaration */ 060 public static final String PARAMETER_OAUTH2_ACCESS_TOKEN = "access_token"; 061 /** method parameter declaration */ 062 public static final String PARAMETER_OAUTH2_AUTHORIZATION_CODE = "code"; 063 /** method parameter declaration */ 064 public static final String PARAMETER_OAUTH2_CLIENT_ID = "client_id"; 065 /** method parameter declaration */ 066 public static final String PARAMETER_OAUTH2_CLIENT_SECRET = "client_secret"; 067 /** method parameter declaration */ 068 public static final String PARAMETER_OAUTH2_ERROR_CODE = "error"; 069 /** method parameter declaration */ 070 public static final String PARAMETER_OAUTH2_GRANT_TYPE = "grant_type"; 071 /** method parameter declaration */ 072 public static final String PARAMETER_OAUTH2_REDIRECT_URI = "redirect_uri"; 073 /** method parameter declaration */ 074 public static final String PARAMETER_OAUTH2_REFRESH_TOKEN = "refresh_token"; 075 /** method parameter declaration */ 076 public static final String PARAMETER_OAUTH2_RESPONSE_TYPE = "response_type"; 077 /** method parameter declaration */ 078 public static final String PARAMETER_OAUTH2_SCOPE = "scope"; 079 /** method parameter declaration */ 080 public static final String PARAMETER_OAUTH2_STATE = "state"; 081 /** method parameter declaration */ 082 public static final String PARAMETER_GOOGLE_TOKEN = "token"; 083 084 /* services */ 085 /** service name declaration */ 086 public static final String SERVICE_USERS_GOOGLE = "google"; 087 088 /** 089 * The grant type of the OAuth2 token. 090 */ 091 public enum OAuth2GrantType{ 092 /** oauth2 authorization code (<a href="https://tools.ietf.org/html/rfc6749#section-1.3.1">OAuth 2 authorization code</a>) */ 093 authorization_code, 094 /** oauth2 refresh token (<a href="https://tools.ietf.org/html/rfc6749#section-1.5">OAuth 2 refresh token</a>) */ 095 refresh_token; 096 097 /** 098 * 099 * @return this grant type as string 100 */ 101 public String toOAuth2GrantType(){ 102 return name(); 103 } 104 } // enum OAuth2GrantType 105 106 /** 107 * 108 */ 109 private Definitions(){ 110 // nothing needed 111 } 112}