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 java.net.URI; 022 023import com.nimbusds.oauth2.sdk.auth.ClientAuthentication; 024 025 026/** 027 * Abstract request with client authentication. 028 * 029 * <p>Client authentication methods: 030 * 031 * <ul> 032 * <li>{@link com.nimbusds.oauth2.sdk.auth.ClientSecretBasic client_secret_basic} 033 * <li>{@link com.nimbusds.oauth2.sdk.auth.ClientSecretPost client_secret_post} 034 * <li>{@link com.nimbusds.oauth2.sdk.auth.ClientSecretJWT client_secret_jwt} 035 * <li>{@link com.nimbusds.oauth2.sdk.auth.PrivateKeyJWT private_key_jwt} 036 * <li>{@link com.nimbusds.oauth2.sdk.auth.SelfSignedTLSClientAuthentication self_signed_tls_client_auth} 037 * <li>{@link com.nimbusds.oauth2.sdk.auth.PKITLSClientAuthentication tls_client_auth} 038 * </ul> 039 */ 040public abstract class AbstractAuthenticatedRequest extends AbstractRequest { 041 042 043 /** 044 * The client authentication. 045 */ 046 private final ClientAuthentication clientAuth; 047 048 049 /** 050 * Creates a new abstract request with client authentication. 051 * 052 * @param uri The URI of the endpoint (HTTP or HTTPS) for which 053 * the request is intended, {@code null} if not 054 * specified (if, for example, the 055 * {@link #toHTTPRequest()} method will not be used). 056 * @param clientAuth The client authentication. Must not be 057 * {@code null}. 058 */ 059 public AbstractAuthenticatedRequest(final URI uri, 060 final ClientAuthentication clientAuth) { 061 062 super(uri); 063 064 if (clientAuth == null) { 065 throw new IllegalArgumentException("The client authentication must not be null"); 066 } 067 068 this.clientAuth = clientAuth; 069 } 070 071 072 /** 073 * Returns the client authentication. 074 * 075 * @return The client authentication. 076 */ 077 public ClientAuthentication getClientAuthentication() { 078 079 return clientAuth; 080 } 081}