public OpenIDProviderData(OpenIDProviderElement opEntry, IRPOptions options) { EntityId = opEntry.EntityId; LoadOPInformation(opEntry); LoadClientInformation(opEntry, options); }
private void LoadClientInformation(OpenIDProviderElement opEntry, IRPOptions options) { SelfRegistered = opEntry.SelfRegistration; if (!SelfRegistered) { foreach (string value in new List <string>() { opEntry.ClientId, opEntry.ClientSecret }) { if (string.IsNullOrEmpty(value)) { throw new ArgumentException("Missign one requred value for configuration. When configuring client without dynamic registration both clientid and clientsecred must be specified."); } } ClientInformation = new OIDCClientInformation() { ClientId = opEntry.ClientId, ClientSecret = opEntry.ClientSecret, TokenEndpointAuthMethod = "client_secret_basic" }; } }
public void RegisterClient(IRPOptions rpOptions, OpenIDUrls urls) { if (SelfRegistered && ClientInformation == null) { OIDCClientInformation clientMetadata = new OIDCClientInformation(); clientMetadata.ApplicationType = "web"; clientMetadata.ResponseTypes = new List <ResponseType>() { ResponseType.Code }; clientMetadata.RedirectUris = new List <string>() { urls.CodeCallbackCommand.ToString() }; clientMetadata.TokenEndpointAuthMethod = "client_secret_basic"; if ((Sign && rpOptions.SignCertificate != null) || (Encrypt && rpOptions.EncCertificate != null)) { clientMetadata.JwksUri = urls.JwksCallbackCommand.ToString(); } OpenIdRelyingParty rp = new OpenIdRelyingParty(); ClientInformation = rp.RegisterClient(ProviderMatadata.RegistrationEndpoint, clientMetadata); } }
public static OpenIDProviderData GetOpenIDProviderData(string entityId, OpenIDProviderElement opEntry, IRPOptions options) { lock (providers) { if (providers.ContainsKey(entityId)) { return providers[entityId]; } OpenIDProviderData op = new OpenIDProviderData(opEntry, options); providers.Add(entityId, op); return op; } }
public OpenIDUrls(IRPOptions rpOptions, Uri baseUrl) { if (baseUrl == null) { throw new ArgumentNullException(nameof(baseUrl)); } if (rpOptions == null) { throw new ArgumentNullException(nameof(rpOptions)); } Init(rpOptions, baseUrl); }
void Init(IRPOptions rpOptions, Uri baseUrl) { string modulePath = rpOptions.ModulePath; if (!modulePath.StartsWith("/", StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("modulePath should start with /."); } ApplicationBase = baseUrl; var authServicesRoot = ApplicationBase.ToString().TrimEnd('/') + modulePath + "/"; AuthenticateCommand = new Uri(authServicesRoot + CommandFactory.AuthenticateCommandName); CodeCallbackCommand = new Uri(authServicesRoot + CommandFactory.CodeCallbackCommandName); JwksCallbackCommand = new Uri(authServicesRoot + CommandFactory.JwksCallbackCommandName); }
public void RegisterClient(IRPOptions rpOptions, OpenIDUrls urls) { if (SelfRegistered && ClientInformation == null) { OIDCClientInformation clientMetadata = new OIDCClientInformation(); clientMetadata.ApplicationType = "web"; clientMetadata.ResponseTypes = new List<ResponseType>() { ResponseType.Code }; clientMetadata.RedirectUris = new List<string>() { urls.CodeCallbackCommand.ToString() }; clientMetadata.TokenEndpointAuthMethod = "client_secret_basic"; if ((Sign && rpOptions.SignCertificate != null) || (Encrypt && rpOptions.EncCertificate != null)) { clientMetadata.JwksUri = urls.JwksCallbackCommand.ToString(); } OpenIdRelyingParty rp = new OpenIdRelyingParty(); ClientInformation = rp.RegisterClient(ProviderMatadata.RegistrationEndpoint, clientMetadata); } }
private void LoadClientInformation(OpenIDProviderElement opEntry, IRPOptions options) { SelfRegistered = opEntry.SelfRegistration; if (!SelfRegistered) { foreach (string value in new List<string>() { opEntry.ClientId, opEntry.ClientSecret }) { if (string.IsNullOrEmpty(value)) { throw new ArgumentException("Missign one requred value for configuration. When configuring client without dynamic registration both clientid and clientsecred must be specified."); } } ClientInformation = new OIDCClientInformation() { ClientId = opEntry.ClientId, ClientSecret = opEntry.ClientSecret, TokenEndpointAuthMethod = "client_secret_basic" }; } }
public Options(OpenIDConfigurationSection Options) { rpOptions = Options; }
public Options(IRPOptions rpOptions) { this.rpOptions = rpOptions; }
public static OpenIDProviderData GetOpenIDProviderData(string entityId, OpenIDProviderElement opEntry, IRPOptions options) { lock (providers) { if (providers.ContainsKey(entityId)) { return(providers[entityId]); } OpenIDProviderData op = new OpenIDProviderData(opEntry, options); providers.Add(entityId, op); return(op); } }