001package com.nimbusds.oauth2.sdk.auth.verifier; 002 003 004import com.nimbusds.oauth2.sdk.ErrorObject; 005import com.nimbusds.oauth2.sdk.GeneralException; 006import com.nimbusds.oauth2.sdk.OAuth2Error; 007 008 009/** 010 * Invalid client exception. Selected static instances are provided to speed up 011 * exception processing. 012 */ 013public class InvalidClientException extends GeneralException { 014 015 016 /** 017 * Bad {@code client_id}. 018 */ 019 public static final InvalidClientException BAD_ID = new InvalidClientException("Bad client ID"); 020 021 022 /** 023 * The client is not registered for the requested authentication 024 * method. 025 */ 026 public static final InvalidClientException NOT_REGISTERED_FOR_AUTH_METHOD = new InvalidClientException("The client is not registered for the requested authentication method"); 027 028 029 /** 030 * The client has no registered {@code client_secret}. 031 */ 032 public static final InvalidClientException NO_REGISTERED_SECRET = new InvalidClientException("The client has no registered secret"); 033 034 035 /** 036 * The client has no registered JWK set. 037 */ 038 public static final InvalidClientException NO_REGISTERED_JWK_SET = new InvalidClientException("The client has no registered JWK set"); 039 040 041 /** 042 * Expired {@code client_secret}. 043 */ 044 public static final InvalidClientException EXPIRED_SECRET = new InvalidClientException("Expired client secret"); 045 046 047 /** 048 * Bad {@code client_secret}. 049 */ 050 public static final InvalidClientException BAD_SECRET = new InvalidClientException("Bad client secret"); 051 052 053 /** 054 * Bad JWT claims (e.g. expired JWT). 055 */ 056 public static final InvalidClientException BAD_JWT_CLAIMS = new InvalidClientException("Bad / expired JWT claims"); 057 058 059 /** 060 * Bad JWT HMAC. 061 */ 062 public static final InvalidClientException BAD_JWT_HMAC = new InvalidClientException("Bad JWT HMAC"); 063 064 065 /** 066 * No matching public JWKs for JWT signature verification found. 067 */ 068 public static final InvalidClientException NO_MATCHING_JWK = new InvalidClientException("No matching JWKs found"); 069 070 071 /** 072 * Bad JWT signature. 073 */ 074 public static final InvalidClientException BAD_JWT_SIGNATURE = new InvalidClientException("Bad JWT signature"); 075 076 077 /** 078 * Creates a new invalid client exception. 079 * 080 * @param message The message. Will not be appended to the OAuth 2.0 081 * error description to be prevent exposing details 082 * about why authentication didn't succeed to the 083 * client. 084 */ 085 public InvalidClientException(final String message) { 086 super(message); 087 } 088 089 090 /** 091 * Returns an OAuth 2.0 error object representation. 092 * 093 * @return {@link OAuth2Error#INVALID_CLIENT}. 094 */ 095 @Override 096 public ErrorObject getErrorObject() { 097 return OAuth2Error.INVALID_CLIENT; 098 } 099 100 101 102}