001package com.nimbusds.oauth2.sdk;
002
003
004import net.jcip.annotations.Immutable;
005
006import com.nimbusds.oauth2.sdk.id.Identifier;
007
008
009/**
010 * Authorisation response mode.
011 *
012 * <p>Related specifications:
013 *
014 * <ul>
015 *     <li>OAuth 2.0 Multiple Response Type Encoding Practices 1.0.
016 *     <li>OAuth 2.0 Form Post Response Mode 1.0.
017 * </ul>
018 */
019@Immutable
020public final class ResponseMode extends Identifier {
021
022
023        /**
024         * The authorisation response parameters are encoded in the query
025         * string added to the {@code redirect_uri} when redirecting back to
026         * the client.
027         */
028        public static final ResponseMode QUERY = new ResponseMode("query");
029
030
031        /**
032         * The authorisation response parameters are encoded in the fragment
033         * added to the {@code redirect_uri} when redirecting back to the
034         * client.
035         */
036        public static final ResponseMode FRAGMENT = new ResponseMode("fragment");
037
038
039        /**
040         * The authorisation response parameters are encoded as HTML form
041         * values that are auto-submitted in the User Agent, and thus are
042         * transmitted via the HTTP POST method to the client, with the result
043         * parameters being encoded in the body using the
044         * {@code application/x-www-form-urlencoded} format. The action
045         * attribute of the form MUST be the client's redirection URI. The
046         * method of the form attribute MUST be POST.
047         */
048        public static final ResponseMode FORM_POST = new ResponseMode("form_post");
049
050
051        /**
052         * Creates a new authorisation response mode with the specified value.
053         *
054         * @param value The response mode value. Must not be {@code null}.
055         */
056        public ResponseMode(final String value) {
057
058                super(value);
059        }
060
061
062        @Override
063        public boolean equals(final Object object) {
064
065                return object instanceof ResponseMode &&
066                        this.toString().equals(object.toString());
067        }
068}