001/*
002 * (C) Copyright 2014 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 *     Arnaud Kervern
018 */
019package org.nuxeo.ecm.platform.oauth2.request;
020
021import static org.nuxeo.ecm.platform.oauth2.Constants.AUTHORIZATION_CODE_PARAM;
022import static org.nuxeo.ecm.platform.oauth2.Constants.CLIENT_SECRET_PARAM;
023import static org.nuxeo.ecm.platform.oauth2.Constants.GRANT_TYPE_PARAM;
024import static org.nuxeo.ecm.platform.oauth2.Constants.REFRESH_TOKEN_PARAM;
025
026import javax.servlet.http.HttpServletRequest;
027
028/**
029 * @author <a href="mailto:ak@nuxeo.com">Arnaud Kervern</a>
030 * @since 5.9.2
031 */
032public class TokenRequest extends OAuth2Request {
033
034    protected String grantType;
035
036    protected String code;
037
038    protected String clientSecret;
039
040    protected String refreshToken;
041
042    public TokenRequest(HttpServletRequest request) {
043        super(request);
044        grantType = request.getParameter(GRANT_TYPE_PARAM);
045        code = request.getParameter(AUTHORIZATION_CODE_PARAM);
046        clientSecret = request.getParameter(CLIENT_SECRET_PARAM);
047        refreshToken = request.getParameter(REFRESH_TOKEN_PARAM);
048    }
049
050    public String getGrantType() {
051        return grantType;
052    }
053
054    public String getCode() {
055        return code;
056    }
057
058    public String getClientSecret() {
059        return clientSecret;
060    }
061
062    public String getRefreshToken() {
063        return refreshToken;
064    }
065}