/// <summary> /// Add the conventional id server metadata mvc controllers. Be sure to call this after AddConventionalIdServerAuthentication /// so the options are setup. /// </summary> /// <param name="builder"></param> /// <returns></returns> public static IMvcBuilder AddConventionalIdServerMvc(this IMvcBuilder builder) { if (options == null) { throw new InvalidOperationException("You must call AddIdServerAuthentication before calling AddIdServerMetadata so the options will be setup."); } if (options.EnableIdServerMetadata) { builder.AddIdServerMetadata(o => { o.Enabled = options.EnableIdServerMetadata; if (options.ActAsApi) { o.CreateConventionalResource(options.AppOptions.Scope, options.AppOptions.DisplayName); } if (options.ActAsClient) { o.CreateConventionalClient(options.AppOptions.ClientId, options.AppOptions.DisplayName, options.AppOptions.Scope, options.SignedOutCallbackPath, options.AppOptions.AdditionalScopes); } if (options.CreateClientCredentialsMetadata) { o.CreateConventionalClientCredentials(options.AppOptions.ClientId, options.AppOptions.DisplayName, options.AppOptions.ClientCredentialsScopes); } }); } return(builder); }