行业洞察
2026-08-08 17:55:36
5GC中基于NRF的SBI授权
基于NRF的OAuth 2.0授权通过签发限定范围的访问令牌、验证NF权限,并将服务发现与安全服务访问分离,从而保护5GC服务化接口。

贝克电信

5GC中基于NRF的SBI授权

在5G服务化架构中,AMF可以发现UDM或SMF的SBI端点,但仅完成发现并不代表其有权读取用户数据或创建PDU会话。服务化通信提高了网络功能之间交互的灵活性,同时也暴露了更广泛的核心网API。如果NF服务生产者在未进行授权检查的情况下处理所有可达请求,就无法可靠判断调用方是否合法、是否已注册,或是否获准使用所请求的服务。

5GC通过基于OAuth 2.0的授权模型解决这一问题。NF服务消费者首先向NRF申请访问令牌,随后在调用目标NF服务生产者时提交该令牌。生产者只有在验证令牌及其授权声明后才执行所请求的操作。在这一模型中,NRF不仅承担注册库和发现功能,还充当受保护SBI访问的授权服务器。

未受保护的SBI调用风险

5G独立组网采用服务化架构,AMF、SMF、UDM和AUSF等网络功能通过基于HTTP/2的服务化接口公开一个或多个服务。消费者可通过标准化HTTP API调用这些服务,从而减少紧密的点到点依赖,并支持动态建立服务关系。

例如,在UE注册过程中,AMF可能调用UDM的Nudm_SDM服务以获取签约信息;在建立PDU会话时,AMF可能调用SMF的Nsmf_PDUSession服务以创建会话管理上下文。这两类流程都涉及敏感的用户信息或关键的核心网资源。

如果UDM仅因请求到达正确URI就返回签约数据,它无法确认调用方是否为已授权的AMF。同样,如果SMF在未验证请求方身份的情况下创建会话,就可能接受来自不可信或配置错误网络功能的调用。端点可达仅说明通信在技术上可行,并不能证明身份或授权。

在云原生部署中,这类风险更加突出。NF实例可能随着运维需求变化而被创建、扩缩容、升级、迁移或删除。服务消费者也可通过NRF发现选择不同的生产者实例。因此,静态地址和固定对等配置不足以控制每一次独立的服务请求。

5GC将服务发现与服务授权分离。发现回答的是合适服务位于何处,授权决定当前消费者是否有权使用该服务。在业务请求被处理之前,消费者必须获取与目标服务相关的凭据,生产者也必须验证该凭据。

NRF作为授权服务器

OAuth 2.0是一种用于应用之间受控访问的通用授权框架,并非移动网络专用。其标准模型定义了三个主要角色:请求访问的客户端、签发令牌的授权服务器,以及保护目标资源或服务的资源服务器。

在5GC SBI安全模型中,这些角色可直接映射到网络功能行为:

OAuth 2.0角色 5GC实体 主要职责
客户端 NF服务消费者 请求访问令牌并发起服务调用
资源服务器 NF服务生产者 提供SBI服务并验证提交的令牌
授权服务器 NRF 评估请求并签发具有指定范围的访问令牌

当AMF需要调用UDM服务时,AMF作为NF服务消费者,UDM作为NF服务生产者,NRF则提供授权功能。AMF在调用Nudm_SDM之前先获取令牌,UDM随后检查该令牌是否有效,以及其声明是否允许访问所请求的服务。

为支持这一流程,NRF公开Nnrf_AccessToken服务。令牌请求可包含消费者身份、所请求服务名称、目标NF类型、消费者NF类型和客户端标识等信息。NRF评估请求后,会返回访问令牌以及令牌类型、有效期等相关信息。

5GC OAuth 2.0角色映射,展示NF服务消费者、NRF授权服务器与NF服务生产者之间的关系
NF服务消费者请求授权,NRF签发令牌,NF服务生产者在执行服务前验证令牌。

NRF不执行所请求的业务操作。它定义授权上下文并签发访问凭据。用户数据读取、会话创建以及其他特定服务操作仍由相应的NF服务生产者负责。

基于令牌的服务访问流程

5GC定义的NF服务访问流程可分为两个阶段。消费者首先从NRF获取访问令牌,然后在请求实际服务时向目标生产者提交该令牌。这种分离可阻止未经验证的请求直接进入业务处理。

请求访问令牌

NF服务消费者首先应具备可供NRF识别的有效身份和注册上下文。随后,它调用Nnrf_AccessToken,并指明拟访问的服务、目标NF类型以及自身消费者信息。

NRF根据现有注册数据和授权策略评估请求。若授权通过,NRF生成访问令牌并返回给消费者。此时尚未执行用户查询、会话创建或其他业务操作,消费者仅获得了尝试调用受保护服务的权限。

调用受保护服务

消费者向NF服务生产者发送业务请求,并在HTTP Authorization请求头中携带访问令牌。生产者在处理请求前会验证令牌的完整性、有效期和授权声明,只有所有检查通过后才执行所请求的服务。

以PDU会话建立为例,AMF首先向NRF的Nnrf_AccessToken服务发送HTTP/2 POST请求,说明需要访问SMF的Nsmf_PDUSession服务。授权通过后,NRF在HTTP 200 OK响应中返回令牌。

随后,AMF向选定的SMF发送Nsmf_PDUSession请求并携带令牌。SMF在创建PDU会话管理上下文之前验证该凭据。如果请求被接受且上下文创建成功,SMF可以返回HTTP 201 Created响应。

5GC访问令牌流程:AMF在调用SMF的PDU会话服务前先从NRF获取令牌
AMF从NRF获取访问令牌,将其提交给SMF,并在令牌验证成功后获得服务响应。

这一流程将授权置于业务执行之前。仅知道SMF地址和API路径并不足够;如果没有覆盖目标服务的有效令牌,请求方不应被允许继续进行正常的会话创建。

范围与设计边界

基于NRF的服务发现与基于NRF的授权彼此相关,但属于不同能力。服务发现用于识别可用的生产者实例及其支持的服务;授权则决定特定消费者是否可以调用其中某项服务。完成发现并不能免除获取适当令牌的要求。

访问令牌也不能替代业务数据。NRF在签发令牌时不会读取UDM签约信息,也不会创建SMF会话。令牌只是证明消费者已在限定范围内获得授权,生产者仍负责处理请求并生成响应。

安全实现必须在生产者侧落实强制校验。如果生产者在执行服务前不验证令牌完整性、过期时间和声明,那么要求消费者申请令牌几乎无法提供有效保护。因此,消费者、NRF和生产者必须遵循兼容的令牌处理规则。

授权还受到范围和时间限制。针对某一SBI服务签发的令牌,并不会自动授予对其他网络功能所有接口的无限访问权。已过期的令牌,或声明与目标服务不匹配的令牌,都不得被视为有效凭据。

因此,NRF在5G核心网中支持两类不同的安全相关功能:一是维护NF配置文件并支持服务发现,帮助消费者定位合适的生产者;二是通过Nnrf_AccessToken控制这些消费者是否获准调用受保护的SBI服务。

常见问题

访问令牌可以替代NF注册吗?

不能。NF注册用于建立实例身份及其服务配置文件,访问令牌则为特定的服务访问上下文提供授权。注册与令牌签发承担不同作用。

一个令牌可以用于多个NF实例吗?

这取决于令牌声明、目标NF类型、服务范围和适用的授权策略。每个生产者都必须验证该令牌是否适用于当前请求,不能仅因令牌尚未过期就直接接受。

NRF不可用时,已签发令牌会立即失效吗?

具体行为取决于令牌格式、有效期、生产者侧验证方式和部署策略。NRF暂时中断并不会自动决定所有已签发令牌的状态,但新的令牌请求可能会受到影响。

OAuth 2.0会加密SBI消息内容吗?

不会。OAuth 2.0主要提供授权和访问控制。SBI传输保护由TLS等独立安全机制实现。有效的访问令牌不能被视为加密传输的替代方案。

推荐产品
目录
客服 电话
We use cookie to improve your online experience. By continuing to browse this website, you agree to our use of cookie.

Cookies

This Cookie Policy explains how we use cookies and similar technologies when you access or use our website and related services. Please read this Policy together with our Terms and Conditions and Privacy Policy so that you understand how we collect, use, and protect information.

By continuing to access or use our Services, you acknowledge that cookies and similar technologies may be used as described in this Policy, subject to applicable law and your available choices.

Updates to This Cookie Policy

We may revise this Cookie Policy from time to time to reflect changes in legal requirements, technology, or our business practices. When we make updates, the revised version will be posted on this page and will become effective from the date of publication unless otherwise required by law.

Where required, we will provide additional notice or request your consent before applying material changes that affect your rights or choices.

What Are Cookies?

Cookies are small text files placed on your device when you visit a website or interact with certain online content. They help websites recognize your browser or device, remember your preferences, support essential functionality, and improve the overall user experience.

In this Cookie Policy, the term “cookies” also includes similar technologies such as pixels, tags, web beacons, and other tracking tools that perform comparable functions.

Why We Use Cookies

We use cookies to help our website function properly, remember user preferences, enhance website performance, understand how visitors interact with our pages, and support security, analytics, and marketing activities where permitted by law.

We use cookies to keep our website functional, secure, efficient, and more relevant to your browsing experience.

Categories of Cookies We Use

Strictly Necessary Cookies

These cookies are essential for the operation of the website and cannot be disabled in our systems where they are required to provide the service you request. They are typically set in response to actions such as setting privacy preferences, signing in, or submitting forms.

Without these cookies, certain parts of the website may not function correctly.

Functional Cookies

Functional cookies enable enhanced features and personalization, such as remembering your preferences, language settings, or previously selected options. These cookies may be set by us or by third-party providers whose services are integrated into our website.

If you disable these cookies, some services or features may not work as intended.

Performance and Analytics Cookies

These cookies help us understand how visitors use our website by collecting information such as traffic sources, page visits, navigation behavior, and general interaction patterns. In many cases, this information is aggregated and does not directly identify individual users.

We use this information to improve website performance, usability, and content relevance.

Targeting and Advertising Cookies

These cookies may be placed by our advertising or marketing partners to help deliver more relevant ads and measure the effectiveness of campaigns. They may use information about your browsing activity across different websites and services to build a profile of your interests.

These cookies generally do not store directly identifying personal information, but they may identify your browser or device.

First-Party and Third-Party Cookies

Some cookies are set directly by our website and are referred to as first-party cookies. Other cookies are set by third-party services, such as analytics providers, embedded content providers, or advertising partners, and are referred to as third-party cookies.

Third-party providers may use their own cookies in accordance with their own privacy and cookie policies.

Information Collected Through Cookies

Depending on the type of cookie used, the information collected may include browser type, device type, IP address, referring website, pages viewed, time spent on pages, clickstream behavior, and general usage patterns.

This information helps us maintain the website, improve performance, enhance security, and provide a better user experience.

Your Cookie Choices

You can control or disable cookies through your browser settings and, where available, through our cookie consent or preference management tools. Depending on your location, you may also have the right to accept or reject certain categories of cookies, especially those used for analytics, personalization, or advertising purposes.

Please note that blocking or deleting certain cookies may affect the availability, functionality, or performance of some parts of the website.

Restricting cookies may limit certain features and reduce the quality of your experience on the website.

Cookies in Mobile Applications

Where our mobile applications use cookie-like technologies, they are generally limited to those required for core functionality, security, and service delivery. Disabling these essential technologies may affect the normal operation of the application.

We do not use essential mobile application cookies to store unnecessary personal information.

How to Manage Cookies

Most web browsers allow you to manage cookies through browser settings. You can usually choose to block, delete, or receive alerts before cookies are stored. Because browser controls vary, please refer to your browser provider’s support documentation for details on how to manage cookie settings.

Contact Us

If you have any questions about this Cookie Policy or our use of cookies and similar technologies, please contact us at support@becke.cc .