001/* 002 * Copyright 2016 The AppAuth for Android Authors. All Rights Reserved. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 005 * in compliance with the License. You may obtain a copy of the License at 006 * 007 * http://www.apache.org/licenses/LICENSE-2.0 008 * 009 * Unless required by applicable law or agreed to in writing, software distributed under the 010 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 011 * express or implied. See the License for the specific language governing permissions and 012 * limitations under the License. 013 */ 014 015package net.openid.appauth; 016 017import androidx.annotation.NonNull; 018 019import java.util.Map; 020 021public interface ClientAuthentication { 022 /** 023 * Thrown when a mandatory property is missing from the registration response. 024 */ 025 class UnsupportedAuthenticationMethod extends Exception { 026 private String mAuthMethod; 027 028 /** 029 * Indicates that the specified client authentication method is unsupported. 030 */ 031 public UnsupportedAuthenticationMethod(String field) { 032 super("Unsupported client authentication method: " + field); 033 mAuthMethod = field; 034 } 035 036 public String getUnsupportedAuthenticationMethod() { 037 return mAuthMethod; 038 } 039 } 040 041 /** 042 * Constructs any extra parameters necessary to include in the request headers for the client 043 * authentication. 044 */ 045 Map<String, String> getRequestHeaders(@NonNull String clientId); 046 047 /** 048 * Constructs any extra parameters necessary to include in the request body for the client 049 * authentication. 050 */ 051 Map<String, String> getRequestParameters(@NonNull String clientId); 052}