All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nimbusds.oauth2.sdk.pkce.CodeVerifier Maven / Gradle / Ivy

Go to download

OAuth 2.0 SDK with OpenID Connection extensions for developing client and server applications.

There is a newer version: 11.21
Show newest version
package com.nimbusds.oauth2.sdk.pkce;


import com.nimbusds.oauth2.sdk.auth.Secret;


/**
 * Authorisation code verifier.
 *
 * 

Related specifications: * *

    *
  • Proof Key for Code Exchange by OAuth Public Clients (RFC 7636). *
*/ public class CodeVerifier extends Secret { /** * The minimal character length of a code verifier. */ public static final int MIN_LENGTH = 43; /** * The maximum character length of a code verifier. */ public static final int MAX_LENGTH = 128; /** * Creates a new code verifier with the specified value. * * @param value The code verifier value. Must not contain characters * other than [A-Z] / [a-z] / [0-9] / "-" / "." / "_" / * "~". The verifier length must be at least 43 * characters but not more than 128 characters. Must not * be {@code null} or empty string. */ public CodeVerifier(final String value) { super(value); if (value.length() < MIN_LENGTH) { throw new IllegalArgumentException("The code verifier must be at least " + MIN_LENGTH + " characters"); } if (value.length() > MAX_LENGTH) { throw new IllegalArgumentException("The code verifier must not be longer than " + MAX_LENGTH + " characters"); } } /** * Creates a new code verifier with the minimum (43 character) length. */ public CodeVerifier() { super(32); } @Override public boolean equals(final Object object) { return object instanceof CodeVerifier && super.equals(object); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy