{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'OCR模型免费转Markdown' && linkText !== 'OCR模型免费转Markdown' ) { link.textContent = 'OCR模型免费转Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== '模型下载攻略' ) { link.textContent = '模型下载攻略'; link.href = '/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'OCR模型免费转Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \n\n\n\n===========\nvar searchData=\n[\n ['in_5frange_194',['in_range',['../class_threshold_transform.html#a874992f571166f58cd7ef73856d30509',1,'ThresholdTransform']]],\n ['ina219_195',['INA219',['../class_i_n_a219.html',1,'INA219'],['../class_i_n_a219.html#a3bdfe18ddb1ca53b53f48ac8672a94d0',1,'INA219::ina219()'],['../class_i_n_a219_value.html#afbc6bf7ce37f6c243d0f944bfa9cfef3',1,'INA219Value::ina219()'],['../class_i_n_a219.html#adc0300a6f6fa99ee85786a354614e343',1,'INA219::INA219()']]],\n ['ina219_2ecpp_196',['ina219.cpp',['../ina219_8cpp.html',1,'']]],\n ['ina219_2eh_197',['ina219.h',['../ina219_8h.html',1,'']]],\n ['ina219cal_5ft_198',['INA219CAL_t',['../ina219_8h.html#af0f21d23ba16939156ae369e49fc59d0',1,'ina219.h']]],\n ['ina219valtype_199',['INA219ValType',['../ina219_8h.html#a80681f57fd3d14d390d830a2ea845654',1,'ina219.h']]],\n ['ina219value_200',['INA219Value',['../class_i_n_a219_value.html',1,'INA219Value'],['../class_i_n_a219_value.html#a929d4abc76063b697a4836da30d1d5c6',1,'INA219Value::INA219Value()'],['../ina219_8h.html#aab1b0e7a44b1751e455f2f0716da1794',1,'INA219value(): ina219.h']]],\n ['index_2eh_201',['index.h',['../index_8h.html',1,'']]],\n ['initfilter_202',['initFilter',['../class_sensor_n_x_p___f_x_o_s8700___f_x_a_s21002.html#a68de3c26ea9715291dcaee9d1260c149',1,'SensorNXP_FXOS8700_FXAS21002']]],\n ['input_203',['input',['../class_curve_interpolator_1_1_sample.html#a43dd7cc1fd950a03a6674056194e935b',1,'CurveInterpolator::Sample']]],\n ['input_5fbuffer_5flength_204',['INPUT_BUFFER_LENGTH',['../nmea__parser_8h.html#a6088978b66925a9ff44bbdf302f00726',1,'nmea_parser.h']]],\n ['integerconsumer_205',['IntegerConsumer',['../valueconsumer_8h.html#a45a844f7269f830a1f708f965627248c',1,'valueconsumer.h']]],\n ['integerproducer_206',['IntegerProducer',['../valueproducer_8h.html#ab74ca4be7de22a21f73128ea38a4cbbb',1,'valueproducer.h']]],\n ['integersensor_207',['IntegerSensor',['../class_integer_sensor.html',1,'IntegerSensor'],['../class_integer_sensor.html#a2214ecc518fbbb314be8ca987aa0e730',1,'IntegerSensor::IntegerSensor()']]],\n ['integerthreshold_208',['IntegerThreshold',['../class_integer_threshold.html',1,'IntegerThreshold'],['../class_integer_threshold.html#a63bb646505b2c51b0d57b0799d062d86',1,'IntegerThreshold::IntegerThreshold()']]],\n ['integertransform_209',['IntegerTransform',['../transform_8h.html#ae9c0b5d70ecdf35d4bd3a0a4bd4e0d17',1,'transform.h']]],\n ['integrator_210',['Integrator',['../class_integrator.html',1,'Integrator'],['../class_integrator.html#a787de1dd45b1ced5607e6209f0e01dd0',1,'Integrator::Integrator()']]],\n ['integrator_2ecpp_211',['integrator.cpp',['../integrator_8cpp.html',1,'']]],\n ['integrator_2eh_212',['integrator.h',['../integrator_8h.html',1,'']]],\n ['interrupt_5ftype_213',['interrupt_type',['../class_digital_input.html#aa4e30fc0836ce2d0934b9eb5d507f116',1,'DigitalInput']]],\n ['ip_5faddress_214',['IP_ADDRESS',['../sensesp__app_8h.html#abeacf3e22e82961fc23c43cad734ebbdad623eb60dd773b245fe13ee928fd47c8',1,'sensesp_app.h']]],\n ['ipaddrdev_215',['IPAddrDev',['../class_i_p_addr_dev.html',1,'IPAddrDev'],['../class_i_p_addr_dev.html#ae5d89601ff69fb635850bbaacdd61664',1,'IPAddrDev::IPAddrDev()']]],\n ['is_5fconnected_216',['is_connected',['../class_w_s_client.html#a6ae43b80f511194b43b0dff2763d68b1',1,'WSClient']]],\n ['issignalkconnected_217',['isSignalKConnected',['../class_sens_e_s_p_app.html#adee3f53bc75ae6d5d73a8707dd75600e',1,'SensESPApp']]],\n ['iswificonnected_218',['isWifiConnected',['../class_sens_e_s_p_app.html#a15f6e0569533b417e9724540d758c884',1,'SensESPApp']]]\n];\n\n/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc\n */\nimport { decimalFormatted } from './../services/utilities';\n/** @type {?} */\nexport const sumTotalsDollarColoredBoldFormatter = (/**\n * @param {?} totals\n * @param {?} columnDef\n * @param {?=} grid\n * @return {?}\n */\n(totals, columnDef, grid) => {\n /** @type {?} */\n const field = columnDef.field || '';\n /** @type {?} */\n const val = totals.sum && totals.sum[field];\n /** @type {?} */\n const prefix = (columnDef.params && columnDef.params.groupFormatterPrefix) ? columnDef.params.groupFormatterPrefix : '';\n /** @type {?} */\n const suffix = (columnDef.params && columnDef.params.groupFormatterSuffix) ? columnDef.params.groupFormatterSuffix : '';\n if (isNaN(+val)) {\n return '';\n }\n else if (val >= 0) {\n return `${prefix + '$' + decimalFormatted(val, 2, 2) + suffix}`;\n }\n else {\n return `${prefix + '$' + decimalFormatted(val, 2, 2) + suffix}`;\n }\n});\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3VtVG90YWxzRG9sbGFyQ29sb3JlZEJvbGRGb3JtYXR0ZXIuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9hbmd1bGFyLXN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0dGVyU3VmZml4IDogJyc7XHJcblxyXG4gIGlmIChpc05hTigrdmFsKSkge1xyXG4gICAgcmV0dXJuICcnO1xyXG4gIH0gZWxzZSBpZiAodmFsID49IDApIHtcclxuICAgIHJldHVybiBgPHNwYW4gc3R5bGU9XCJjb2xvcjpncmVlbjsgZm9udC13ZWlnaHQ6IGJvbGQ7XCI+JHtwcmVmaXggKyAnJCcgKyBkZWNpbWFsRm9ybWF0dGVkKHZhbCwgMiwgMikgKyBzdWZmaXh9PC9zcGFuPmA7XHJcbiAgfSBlbHNlIHtcclxuICAgIHJldHVybiBgPHNwYW4gc3R5bGU9XCJjb2xvcjpyZWQ7IGZvbnQtd2VpZ2h0OiBib2xkO1wiPiR7cHJlZml4ICsgJyQnICsgZGVjaW1hbEZvcm1hdHRlZCh2YWwsIDIsIDIpICsgc3VmZml4fTwvc3Bhbj5gO1xyXG4gIH1cclxufTtcclxuIl19\n\n===========\nExample of Image with WLS Domain\n================================\nThis Dockerfile extends the Oracle WebLogic image by applying a PSU patch.\n\n# How to build and run\nFirst make sure you have built **oracle/weblogic:12.2.1.1-developer**.\n\nThen download file [p24286152_122110_Generic.zip](http://support.oracle.com) and place it next to this README.\n\nTo build, run:\n\n $ docker build -t 12211-psu24286152 .\n\nTo start the Admin Server, run:\n\n $ docker run -p 7001:7001 12211-psu24286152\n\nWhen you run the container a patched WebLogic Server 12.2.1.1 empty domain is created. At startup of the container a random password will be generated for the Administration of the domain. You can find this password in the output line:\n\n`Oracle WebLogic Server auto generated Admin password:`\n\nGo to your browser and start the Adminsitration console by running:\n http://localhost:7001/console\n\nExtend this patched image to create a domain image and start WebLogic Servers running in containers.\n# Copyright\nCopyright (c) 2018 Oracle and/or its affiliates. All rights reserved.\n\n---\ntitle: Informacje o autoryzacji w mikrousługach .NET i aplikacjach internetowych\ndescription: Zabezpieczenia w mikrousługach platformy .NET i aplikacjach sieci Web — zapoznaj się z omówieniem głównych opcji autoryzacji w aplikacjach ASP.NET Core — opartych na rolach i opartych na zasadach.\nauthor: mjrousos\nms.date: 01/30/2020\nms.openlocfilehash: 27936a33ea2bb46cedb9d10ee47a2117e1843e14\nms.sourcegitcommit: e3cbf26d67f7e9286c7108a2752804050762d02d\nms.translationtype: MT\nms.contentlocale: pl-PL\nms.lasthandoff: 04/09/2020\nms.locfileid: \"80988209\"\n---\n# Informacje o autoryzacji w mikrousługach .NET i aplikacjach internetowych\n\nPo uwierzytelnieniu ASP.NET core interfejsów API sieci Web muszą autoryzować dostęp. Ten proces umożliwia usłudze udostępnianie interfejsów API niektórym uwierzytelnionym użytkownikom, ale nie wszystkim. [Autoryzacja](/aspnet/core/security/authorization/introduction) może być wykonywana na podstawie ról użytkowników lub na podstawie zasad niestandardowych, które mogą obejmować inspekcję oświadczeń lub innych heurystyki.\n\nOgraniczenie dostępu do ASP.NET trasy Core MVC jest tak proste, jak zastosowanie atrybutu Authorize do metody akcji (lub do klasy kontrolera, jeśli wszystkie akcje kontrolera wymagają autoryzacji), jak pokazano na poniższym przykładzie:\n\n```csharp\npublic class AccountController : Controller\n{\n public ActionResult Login()\n {\n }\n\n [Authorize]\n public ActionResult Logout()\n {\n }\n}\n```\n\nDomyślnie dodanie atrybutu Authorize bez parametrów ograniczy dostęp do uwierzytelnionych użytkowników dla tego kontrolera lub akcji. Aby dodatkowo ograniczyć interfejs API, który ma być dostępny tylko dla określonych użytkowników, atrybut można rozwinąć, aby określić wymagane role lub zasady, które użytkownicy muszą spełnić.\n\n## Wdrażanie autoryzacji opartej na rolach\n\nASP.NET Podstawowa tożsamość ma wbudowaną koncepcję ról. Oprócz użytkowników ASP.NET Tożsamość podstawowa przechowuje informacje o różnych rolach używanych przez aplikację i śledzi, którzy użytkownicy są przypisani do ról. Te przypisania można zmienić programowo z typem, `RoleManager` który aktualizuje role w utrwalone magazynu i `UserManager` typu, który może przyznać lub odwołać role od użytkowników.\n\nJeśli uwierzytelniasz się za pomocą tokenów nośnych JWT, ASP.NET core JWT oprogramowanie pośredniczące uwierzytelniania na okaziciela wypełni role użytkownika na podstawie oświadczeń roli znalezionych w tokenie. Aby ograniczyć dostęp do akcji lub kontrolera MVC do użytkowników w określonych rolach, można dołączyć parametr Roles w adnotacji Autoryzacyjnej (atrybut), jak pokazano w następującym fragmencie kodu:\n\n```csharp\n[Authorize(Roles = \"Administrator, PowerUser\")]\npublic class ControlPanelController : Controller\n{\n public ActionResult SetTime()\n {\n }\n\n [Authorize(Roles = \"Administrator\")]\n public ActionResult ShutDown()\n {\n }\n}\n```\n\nW tym przykładzie tylko użytkownicy w rolach administratora lub PowerUser mogą uzyskiwać dostęp do interfejsów API w kontrolerze ControlPanel (na przykład wykonywania akcji SetTime). Interfejs API ShutDown jest dodatkowo ograniczony, aby zezwolić na dostęp tylko do użytkowników w roli administratora.\n\nAby wymagać, aby użytkownik był w wielu rolach, należy użyć wielu atrybutów Autoryzuj, jak pokazano w poniższym przykładzie:\n\n```csharp\n[Authorize(Roles = \"Administrator, PowerUser\")]\n[Authorize(Roles = \"RemoteEmployee \")]\n[Authorize(Policy = \"CustomPolicy\")]\npublic ActionResult API1 ()\n{\n}\n```\n\nW tym przykładzie, aby wywołać API1, użytkownik musi:\n\n- Być w roli administratora *lub* PowerUser, *i*\n\n- Wcielić się w rolę RemoteEmployee *i*\n\n- Spełnij niestandardowy program obsługi autoryzacji CustomPolicy.\n\n## Wdrażanie autoryzacji opartej na zasadach\n\nReguły autoryzacji niestandardowej można również zapisywać przy użyciu [zasad autoryzacji](https://docs.asp.net/en/latest/security/authorization/policies.html). Ta sekcja zawiera omówienie. Aby uzyskać więcej informacji, zobacz [warsztaty autoryzacji ASP.NET](https://github.com/blowdart/AspNetAuthorizationWorkshop).\n\nZasady autoryzacji niestandardowej są rejestrowane w metodzie Startup.ConfigureServices przy użyciu usługi. AddAuthorization metody. Ta metoda przyjmuje pełnomocnika, który konfiguruje argument AuthorizationOptions.\n\n```csharp\nservices.AddAuthorization(options =>\n{\n options.AddPolicy(\"AdministratorsOnly\", policy =>\n policy.RequireRole(\"Administrator\"));\n\n options.AddPolicy(\"EmployeesOnly\", policy =>\n policy.RequireClaim(\"EmployeeNumber\"));\n\n options.AddPolicy(\"Over21\", policy =>\n policy.Requirements.Add(new MinimumAgeRequirement(21)));\n});\n```\n\nJak pokazano w przykładzie, zasady mogą być skojarzone z różnymi typami wymagań. Po zarejestrowaniu zasad można je zastosować do akcji lub kontrolera, przekazując nazwę zasad jako argument Zasad atrybutu Authorize (na przykład `[Authorize(Policy=\"EmployeesOnly\")]`) Zasady mogą mieć wiele wymagań, a nie tylko jeden (jak pokazano w tych przykładach).\n\nW poprzednim przykładzie pierwsze wywołanie AddPolicy jest tylko alternatywnym sposobem autoryzowania przez rolę. Jeśli `[Authorize(Policy=\"AdministratorsOnly\")]` jest stosowany do interfejsu API, tylko użytkownicy w roli administratora będą mogli uzyskać do niego dostęp.\n\nDrugie wywołanie pokazuje łatwy sposób wymagać, że określone oświadczenie powinno być obecne dla użytkownika. Metoda również opcjonalnie przyjmuje oczekiwane wartości dla oświadczenia. Jeśli wartości są określone, wymaganie jest spełnione tylko wtedy, gdy użytkownik ma zarówno oświadczenie prawidłowego typu i jedną z określonych wartości. Jeśli używasz oprogramowania pośredniczącego uwierzytelniania na okaziciela JWT, wszystkie właściwości JWT będą dostępne jako oświadczenia użytkownika.\n\nNajciekawsze zasady pokazane tutaj jest `AddPolicy` w trzeciej metody, ponieważ używa wymagania autoryzacji niestandardowej. Za pomocą wymagań autoryzacji niestandardowej, można mieć dużą kontrolę nad jak autoryzacja jest wykonywana. Aby to zadziałało, należy zaimplementować następujące typy:\n\n- Typ wymagania, który pochodzi z i który zawiera pola określające szczegóły wymagania. W tym przykładzie jest to pole `MinimumAgeRequirement` wiekowe dla typu próbki.\n\n- Program obsługi, który implementuje , gdzie T jest typem, który program obsługi może spełnić. Program obsługi musi implementować metodę, która sprawdza, czy określony kontekst, który zawiera informacje o użytkowniku spełnia wymagania.\n\nJeśli użytkownik spełnia wymagania, wywołanie `context.Succeed` wskazuje, że użytkownik jest autoryzowany. Jeśli istnieje wiele sposobów, że użytkownik może spełnić wymagania autoryzacji, można utworzyć wiele programów obsługi.\n\nOprócz rejestrowania niestandardowych wymagań `AddPolicy` dotyczących zasad za pomocą wywołań, należy również`services.AddTransient()`zarejestrować niestandardowe programy obsługi wymagań za pośrednictwem iniekcji zależności ( ).\n\nPrzykład wymagania autoryzacji niestandardowej i programu obsługi do sprawdzania wieku `DateOfBirth` użytkownika (na podstawie oświadczenia) jest dostępny w [dokumentacji autoryzacji](https://docs.asp.net/en/latest/security/authorization/policies.html)ASP.NET Core .\n\n## Zasoby dodatkowe\n\n- **Uwierzytelnianie ASP.NET rdzeniowe** \\\n [https://docs.microsoft.com/aspnet/core/security/authentication/identity](/aspnet/core/security/authentication/identity)\n\n- **Autoryzacja ASP.NET Core** \\\n [https://docs.microsoft.com/aspnet/core/security/authorization/introduction](/aspnet/core/security/authorization/introduction)\n\n- **Autoryzacja oparta na rolach** \\\n [https://docs.microsoft.com/aspnet/core/security/authorization/roles](/aspnet/core/security/authorization/roles)\n\n- **Autoryzacja oparta na zasadach niestandardowych** \\\n [https://docs.microsoft.com/aspnet/core/security/authorization/policies](/aspnet/core/security/authorization/policies)\n\n>[!div class=\"step-by-step\"]\n>[Poprzedni](index.md)\n>[następny](developer-app-secrets-storage.md)\n\n\n===========\n\"Rules for running Rollup under Bazel\"\n\nload(\"@build_bazel_rules_nodejs//:providers.bzl\", \"JSEcmaScriptModuleInfo\", \"NodeContextInfo\", \"NpmPackageInfo\", \"node_modules_aspect\", \"run_node\")\nload(\"@build_bazel_rules_nodejs//internal/linker:link_node_modules.bzl\", \"module_mappings_aspect\")\n\n_DOC = \"\"\"Runs the Rollup.js CLI under Bazel.\n\nSee https://rollupjs.org/guide/en/#command-line-reference\n\nTypical example:\n```python\nload(\"@npm_bazel_rollup//:index.bzl\", \"rollup_bundle\")\n\nrollup_bundle(\n name = \"bundle\",\n srcs = [\"dependency.js\"],\n entry_point = \"input.js\",\n config_file = \"rollup.config.js\",\n)\n```\n\nNote that the command-line options set by Bazel override what appears in the rollup config file.\nThis means that typically a single `rollup.config.js` can contain settings for your whole repo,\nand multiple `rollup_bundle` rules can share the configuration.\n\nThus, setting options that Bazel controls will have no effect, e.g.\n\n```javascript\nmodule.exports = {\n output: { file: 'this_is_ignored.js' },\n}\n```\n\nYou must determine ahead of time whether Rollup needs to produce a directory output.\nThis is the case if you have dynamic imports which cause code-splitting, or if you\nprovide multiple entry points. Use the `output_dir` attribute to specify that you want a\ndirectory output.\nRollup's CLI has the same behavior, forcing you to pick `--output.file` or `--output.dir`.\n\nTo get multiple output formats, wrap the rule with a macro or list comprehension, e.g.\n\n```python\n[\n rollup_bundle(\n name = \"bundle.%s\" % format,\n entry_point = \"foo.js\",\n format = format,\n )\n for format in [\n \"cjs\",\n \"umd\",\n ]\n]\n```\n\nThis will produce one output per requested format.\n\"\"\"\n\n_ROLLUP_ATTRS = {\n \"srcs\": attr.label_list(\n doc = \"\"\"Non-entry point JavaScript source files from the workspace.\n\nYou must not repeat file(s) passed to entry_point/entry_points.\n\"\"\",\n # Don't try to constrain the filenames, could be json, svg, whatever\n allow_files = True,\n ),\n \"args\": attr.string_list(\n doc = \"\"\"Command line arguments to pass to rollup. Can be used to override config file settings.\n\nThese argument passed on the command line before all arguments that are always added by the\nrule such as `--output.dir` or `--output.file`, `--format`, `--config` and `--preserveSymlinks` and\nalso those that are optionally added by the rule such as `--sourcemap`.\n\nSee rollup CLI docs https://rollupjs.org/guide/en/#command-line-flags for complete list of supported arguments.\"\"\",\n default = [],\n ),\n \"config_file\": attr.label(\n doc = \"\"\"A rollup.config.js file\n\nPassed to the --config \nSee https://rollupjs.org/guide/en/#configuration-files\n\nIf not set, a default basic Rollup config is used.\n\"\"\",\n allow_single_file = True,\n default = \"@npm_bazel_rollup//:rollup.config.js\",\n ),\n \"entry_point\": attr.label(\n doc = \"\"\"The bundle's entry point (e.g. your main.js or app.js or index.js).\n\nThis is just a shortcut for the `entry_points` attribute with a single output chunk named the same as the rule.\n\nFor example, these are equivalent:\n\n```python\nrollup_bundle(\n name = \"bundle\",\n entry_point = \"index.js\",\n)\n```\n\n```python\nrollup_bundle(\n name = \"bundle\",\n entry_points = {\n \"index.js\": \"bundle\"\n }\n)\n```\n\nIf `rollup_bundle` is used on a `ts_library`, the `rollup_bundle` rule handles selecting the correct outputs from `ts_library`.\nIn this case, `entry_point` can be specified as the `.ts` file and `rollup_bundle` will handle the mapping to the `.mjs` output file.\n\nFor example:\n\n```python\nts_library(\n name = \"foo\",\n srcs = [\n \"foo.ts\",\n \"index.ts\",\n ],\n)\n\nrollup_bundle(\n name = \"bundle\",\n deps = [ \"foo\" ],\n entry_point = \"index.ts\",\n)\n```\n\"\"\",\n allow_single_file = True,\n ),\n \"entry_points\": attr.label_keyed_string_dict(\n doc = \"\"\"The bundle's entry points (e.g. your main.js or app.js or index.js).\n\nPassed to the [`--input` option](https://github.com/rollup/rollup/blob/master/docs/999-big-list-of-options.md#input) in Rollup.\n\nKeys in this dictionary are labels pointing to .js entry point files.\nValues are the name to be given to the corresponding output chunk.\n\nEither this attribute or `entry_point` must be specified, but not both.\n\"\"\",\n allow_files = True,\n ),\n \"format\": attr.string(\n doc = \"\"\"\"Specifies the format of the generated bundle. One of the following:\n\n- `amd`: Asynchronous Module Definition, used with module loaders like RequireJS\n- `cjs`: CommonJS, suitable for Node and other bundlers\n- `esm`: Keep the bundle as an ES module file, suitable for other bundlers and inclusion as a `