001package com.box.sdkgen.managers.authorization; 002 003import com.box.sdkgen.serialization.json.EnumWrapper; 004 005public class AuthorizeUserQueryParams { 006 007 /** The type of response we'd like to receive. */ 008 public final EnumWrapper<AuthorizeUserQueryParamsResponseTypeField> responseType; 009 010 /** 011 * The Client ID of the application that is requesting to authenticate the user. To get the Client 012 * ID for your application, log in to your Box developer console and click the **Edit 013 * Application** link for the application you're working with. In the OAuth 2.0 Parameters section 014 * of the configuration page, find the item labelled `client_id`. The text of that item is your 015 * application's Client ID. 016 */ 017 public final String clientId; 018 019 /** 020 * The URI to which Box redirects the browser after the user has granted or denied the application 021 * permission. This URI match one of the redirect URIs in the configuration of your application. 022 * It must be a valid HTTPS URI and it needs to be able to handle the redirection to complete the 023 * next step in the OAuth 2.0 flow. Although this parameter is optional, it must be a part of the 024 * authorization URL if you configured multiple redirect URIs for the application in the developer 025 * console. A missing parameter causes a `redirect_uri_missing` error after the user grants 026 * application access. 027 */ 028 public String redirectUri; 029 030 /** 031 * A custom string of your choice. Box will pass the same string to the redirect URL when 032 * authentication is complete. This parameter can be used to identify a user on redirect, as well 033 * as protect against hijacked sessions and other exploits. 034 */ 035 public String state; 036 037 /** 038 * A space-separated list of application scopes you'd like to authenticate the user for. This 039 * defaults to all the scopes configured for the application in its configuration page. 040 */ 041 public String scope; 042 043 public AuthorizeUserQueryParams( 044 AuthorizeUserQueryParamsResponseTypeField responseType, String clientId) { 045 this.responseType = new EnumWrapper<AuthorizeUserQueryParamsResponseTypeField>(responseType); 046 this.clientId = clientId; 047 } 048 049 public AuthorizeUserQueryParams( 050 EnumWrapper<AuthorizeUserQueryParamsResponseTypeField> responseType, String clientId) { 051 this.responseType = responseType; 052 this.clientId = clientId; 053 } 054 055 protected AuthorizeUserQueryParams(Builder builder) { 056 this.responseType = builder.responseType; 057 this.clientId = builder.clientId; 058 this.redirectUri = builder.redirectUri; 059 this.state = builder.state; 060 this.scope = builder.scope; 061 } 062 063 public EnumWrapper<AuthorizeUserQueryParamsResponseTypeField> getResponseType() { 064 return responseType; 065 } 066 067 public String getClientId() { 068 return clientId; 069 } 070 071 public String getRedirectUri() { 072 return redirectUri; 073 } 074 075 public String getState() { 076 return state; 077 } 078 079 public String getScope() { 080 return scope; 081 } 082 083 public static class Builder { 084 085 protected final EnumWrapper<AuthorizeUserQueryParamsResponseTypeField> responseType; 086 087 protected final String clientId; 088 089 protected String redirectUri; 090 091 protected String state; 092 093 protected String scope; 094 095 public Builder(AuthorizeUserQueryParamsResponseTypeField responseType, String clientId) { 096 this.responseType = new EnumWrapper<AuthorizeUserQueryParamsResponseTypeField>(responseType); 097 this.clientId = clientId; 098 } 099 100 public Builder( 101 EnumWrapper<AuthorizeUserQueryParamsResponseTypeField> responseType, String clientId) { 102 this.responseType = responseType; 103 this.clientId = clientId; 104 } 105 106 public Builder redirectUri(String redirectUri) { 107 this.redirectUri = redirectUri; 108 return this; 109 } 110 111 public Builder state(String state) { 112 this.state = state; 113 return this; 114 } 115 116 public Builder scope(String scope) { 117 this.scope = scope; 118 return this; 119 } 120 121 public AuthorizeUserQueryParams build() { 122 return new AuthorizeUserQueryParams(this); 123 } 124 } 125}