001/* 002 * oauth2-oidc-sdk 003 * 004 * Copyright 2012-2016, Connect2id Ltd and contributors. 005 * 006 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use 007 * this file except in compliance with the License. You may obtain a copy of the 008 * License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software distributed 013 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 014 * CONDITIONS OF ANY KIND, either express or implied. See the License for the 015 * specific language governing permissions and limitations under the License. 016 */ 017 018package com.nimbusds.oauth2.sdk; 019 020 021import net.jcip.annotations.Immutable; 022 023import com.nimbusds.oauth2.sdk.id.Identifier; 024 025 026/** 027 * Authorisation response mode. 028 * 029 * <p>Related specifications: 030 * 031 * <ul> 032 * <li>OAuth 2.0 Multiple Response Type Encoding Practices 1.0. 033 * <li>OAuth 2.0 Form Post Response Mode 1.0. 034 * </ul> 035 */ 036@Immutable 037public final class ResponseMode extends Identifier { 038 039 040 /** 041 * The authorisation response parameters are encoded in the query 042 * string added to the {@code redirect_uri} when redirecting back to 043 * the client. 044 */ 045 public static final ResponseMode QUERY = new ResponseMode("query"); 046 047 048 /** 049 * The authorisation response parameters are encoded in the fragment 050 * added to the {@code redirect_uri} when redirecting back to the 051 * client. 052 */ 053 public static final ResponseMode FRAGMENT = new ResponseMode("fragment"); 054 055 056 /** 057 * The authorisation response parameters are encoded as HTML form 058 * values that are auto-submitted in the User Agent, and thus are 059 * transmitted via the HTTP POST method to the client, with the result 060 * parameters being encoded in the body using the 061 * {@code application/x-www-form-urlencoded} format. The action 062 * attribute of the form MUST be the client's redirection URI. The 063 * method of the form attribute MUST be POST. 064 */ 065 public static final ResponseMode FORM_POST = new ResponseMode("form_post"); 066 067 068 /** 069 * Creates a new authorisation response mode with the specified value. 070 * 071 * @param value The response mode value. Must not be {@code null}. 072 */ 073 public ResponseMode(final String value) { 074 075 super(value); 076 } 077 078 079 @Override 080 public boolean equals(final Object object) { 081 082 return object instanceof ResponseMode && 083 this.toString().equals(object.toString()); 084 } 085}