/// <summary>client_idからclient_nameを取得する。</summary> /// <param name="client_id">client_id</param> /// <returns>client_name</returns> /// <remarks> /// Client Credentialsグラント種別の場合に、 /// ・AccessTokenFormatJwt /// ・OAuthResourceApiController /// からclient_id(aud)に対応するsubを取得するために利用される。 /// </remarks> public string GetClientName(string client_id) { client_id = client_id ?? ""; // *.config内を検索 if (this.OauthClientsInfo.ContainsKey(client_id)) { return(this.OauthClientsInfo[client_id]["client_name"]); } // oAuth2Dataを検索 string oAuth2Data = OAuth2DataProvider.GetInstance().GetOAuth2Data(client_id); if (!string.IsNullOrEmpty(oAuth2Data)) { ManageAddOAuth2DataViewModel model = JsonConvert.DeserializeObject <ManageAddOAuth2DataViewModel>(oAuth2Data); return(model.ClientName); } return(""); }
/// <summary>client_idからresponse_typeに対応するredirect_uriを取得する。</summary> /// <param name="client_id">client_id</param> /// <param name="response_type">response_type</param> /// <returns>redirect_uri</returns> /// <remarks> /// ApplicationOAuthBearerTokenProviderで、 /// redirect_uriが指定されていない場合、 /// client_idの既定のredirect_uriを取得する。 /// </remarks> public string GetClientsRedirectUri(string client_id, string response_type) { client_id = client_id ?? ""; response_type = response_type ?? ""; // *.config内を検索 if (this.OauthClientsInfo.ContainsKey(client_id)) { if (response_type.ToLower() == "code") { return(this.OauthClientsInfo[client_id]["redirect_uri_code"]); } else if (response_type.ToLower() == "token") { return(this.OauthClientsInfo[client_id]["redirect_uri_token"]); } } // OAuth2Dataを検索 string oAuth2Data = OAuth2DataProvider.GetInstance().GetOAuth2Data(client_id); if (!string.IsNullOrEmpty(oAuth2Data)) { ManageAddOAuth2DataViewModel model = JsonConvert.DeserializeObject <ManageAddOAuth2DataViewModel>(oAuth2Data); if (response_type.ToLower() == "code") { return(model.RedirectUriCode); } else if (response_type.ToLower() == "token") { return(model.RedirectUriToken); } } return(""); }