001package com.nimbusds.oauth2.sdk.auth; 002 003 004import com.nimbusds.oauth2.sdk.id.ClientID; 005 006 007/** 008 * Base abstract class for plain secret based client authentication at the 009 * Token endpoint. 010 * 011 * <p>Related specifications: 012 * 013 * <ul> 014 * <li>OAuth 2.0 (RFC 6749), sections 2.3.1 and 3.2.1. 015 * <li>OpenID Connect Core 1.0, section 9. 016 * </ul> 017 */ 018public abstract class PlainClientSecret extends ClientAuthentication { 019 020 021 /** 022 * The client secret. 023 */ 024 private final Secret secret; 025 026 027 /** 028 * Creates a new plain secret based client authentication. 029 * 030 * @param method The client authentication method. Must not be 031 * {@code null}. 032 * @param clientID The client identifier. Must not be {@code null}. 033 * @param secret The client secret. Must not be {@code null}. 034 */ 035 protected PlainClientSecret(final ClientAuthenticationMethod method, 036 final ClientID clientID, 037 final Secret secret) { 038 039 super(method, clientID); 040 041 if (secret == null) { 042 throw new IllegalArgumentException("The client secret must not be null"); 043 } 044 045 this.secret = secret; 046 } 047 048 049 /** 050 * Gets the client secret. 051 * 052 * @return The client secret. 053 */ 054 public Secret getClientSecret() { 055 056 return secret; 057 } 058}