001package org.apache.archiva.redback.rest.api.model.v2;/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 * Unless required by applicable law or agreed to in writing,
012 * software distributed under the License is distributed on an
013 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
014 * KIND, either express or implied.  See the License for the
015 * specific language governing permissions and limitations
016 * under the License.
017 */
018
019import io.swagger.v3.oas.annotations.media.Schema;
020
021import javax.xml.bind.annotation.XmlElement;
022import javax.xml.bind.annotation.XmlRootElement;
023import java.io.Serializable;
024
025/**
026 * @author Martin Stockhammer <martin_s@apache.org>
027 */
028@XmlRootElement( name = "refreshToken" )
029@Schema( name = "TokenRefreshRequest", description = "Information for requesting token from a refresh token" )
030public class TokenRefreshRequest implements Serializable
031{
032
033    private static final long serialVersionUID = 3900011211040344882L;
034    GrantType grantType;
035    String refreshToken;
036    String scope;
037
038    public TokenRefreshRequest( )
039    {
040    }
041
042    public TokenRefreshRequest( GrantType grantType, String refreshToken, String scope )
043    {
044        this.grantType = grantType;
045        this.refreshToken = refreshToken;
046        this.scope = scope;
047    }
048
049    @XmlElement( name = "grant_type", required = true)
050    @Schema(name="grant_type", description = "The grant type for requesting the token. 'refresh_token' for token refresh")
051    public GrantType getGrantType( )
052    {
053        return grantType;
054    }
055
056    public void setGrantType( GrantType grantType )
057    {
058        this.grantType = grantType;
059    }
060
061    @XmlElement( name = "refresh_token" )
062    @Schema(name="refresh_token", description = "The refresh token that is validated before generating the new access token")
063    public String getRefreshToken( )
064    {
065        return refreshToken;
066    }
067
068    public void setRefreshToken( String refreshToken )
069    {
070        this.refreshToken = refreshToken;
071    }
072
073    @XmlElement( name = "scope")
074    @Schema(description = "The scope for the new access token.")
075    public String getScope( )
076    {
077        return scope;
078    }
079
080    public void setScope( String scope )
081    {
082        this.scope = scope;
083    }
084}