You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: This topic explains security for Azure notification hubs.
3
+
description: This topic explains security for Azure Notification Hubs.
4
4
services: notification-hubs
5
5
documentationcenter: .net
6
6
author: sethmanheim
7
7
manager: femila
8
8
editor: jwargo
9
9
10
-
ms.assetid: 6506177c-e25c-4af7-8508-a3ddca9dc07c
10
+
ms.assetid:
11
11
ms.service: notification-hubs
12
12
ms.workload: mobile
13
13
ms.tgt_pltfrm: mobile-multiple
14
14
ms.devlang: multiple
15
15
ms.topic: article
16
-
ms.date: 05/31/2019
16
+
ms.date: 09/23/2019
17
17
ms.author: sethm
18
18
ms.reviewer: jowargo
19
-
ms.lastreviewed: 05/31/2019
19
+
ms.lastreviewed: 09/23/2019
20
20
---
21
21
22
-
# Notification Hubs Security
22
+
# Notification Hubs security
23
23
24
24
## Overview
25
25
26
26
This topic describes the security model of Azure Notification Hubs.
27
27
28
-
## Shared Access Signature Security (SAS)
28
+
## Shared Access Signature security
29
29
30
-
Notification Hubs implements an entity-level security scheme called SAS (Shared Access Signature). Each rule contains a name, a key value (shared secret), and a set of rights, as explained in [Security Claims](#security-claims). When creating a Notification Hub, two rules are automatically created: one with **Listen** rights (that the client app uses) and one with **all** rights (that the app backend uses).
30
+
Notification Hubs implements an entity-level security scheme called a *Shared Access Signature* (SAS). Each rule contains a name, a key value (shared secret), and a set of rights, as explained later in [Security claims](#security-claims).
31
+
32
+
When creating a hub, two rules are automatically created: one with **Listen** rights (that the client app uses) and one with **all** rights (that the app backend uses):
-**DefaultFullSharedAccessSignature**: grants **Listen**, **Manage**, and **Send** permissions. This policy is to be used only in your app backend. Do not use it in client applications; use a policy with only **Listen** access. To create a new custom access policy with a new SAS token, see [SAS tokens for access policies](#sas-tokens-for-access-policies) later in this article.
31
36
32
37
When performing registration management from client apps, if the information sent via notifications is not sensitive (for example, weather updates), a common way to access a Notification Hub is to give the key value of the rule Listen-only access to the client app, and to give the key value of the rule full access to the app backend.
33
38
34
-
Apps should not embed the key value in Windows Store client apps, instead have the client app retrieve it from the app backend at startup.
39
+
Apps should not embed the key value in Windows Store client apps; instead, have the client app retrieve it from the app backend at startup.
35
40
36
-
The key with **Listen** access allows a client app to register for any tag. If your app must restrict registrations to specific tags to specific clients (for example, when tags represent user IDs), your app backend must perform the registrations. For more information, see [Registration Management](notification-hubs-push-notification-registration-management.md). Note that in this way, the client app will not have direct access to Notification Hubs.
41
+
The key with **Listen** access allows a client app to register for any tag. If your app must restrict registrations to specific tags to specific clients (for example, when tags represent user IDs), your app backend must perform the registrations. For more information, see [Registration management](notification-hubs-push-notification-registration-management.md). Note that in this way, the client app will not have direct access to Notification Hubs.
37
42
38
43
## Security claims
39
44
@@ -42,10 +47,34 @@ Similar to other entities, Notification Hub operations are allowed for three sec
| Listen | Create/Update, Read, and Delete single registrations | Create/Update registration<br><br>Read registration<br><br>Read all registrations for a handle<br><br>Delete registration |
45
-
| Send | Send messages to the notification hub | Send message |
46
-
| Manage | CRUDs on Notification Hubs (including updating PNS credentials, and security keys), and read registrations based on tags |Create/Update/Read/Delete notification hubs<br><br>Read registrations by tag |
50
+
| Send | Send messages to the Notification Hub | Send message |
51
+
| Manage | CRUDs on Notification Hubs (including updating PNS credentials, and security keys), and read registrations based on tags |Create/Update/Read/Delete hubs<br><br>Read registrations by tag |
52
+
53
+
Notification Hubs accepts SAS tokens generated with shared keys configured directly on the hub.
54
+
55
+
It is not possible to send a notification to more than one namespace. Namespaces are logical containers for Notification Hubs and are not involved in sending notifications.
56
+
57
+
Use the namespace-level access policies (credentials) for namespace-level operations; for example: listing hubs, creating or deleting hubs, etc. Only the hub-level access policies let you send notifications.
58
+
59
+
### SAS tokens for access policies
60
+
61
+
To create a new security claim or to view existing SAS keys, do the following:
62
+
63
+
1. Sign in to the Azure portal.
64
+
2. Select **All resources**.
65
+
3. Select the name of the Notification Hub for which you want to create the claim or view the SAS key.
66
+
4. In the left-hand menu, select **Access Policies**.
67
+
5. Select **New Policy** to create a new security claim. Give the policy a name, and select the permissions you want to grant. Then select **OK**.
68
+
6. The full connection string (including the new SAS key) is displayed in the Access Policies window. You can copy this string to the clipboard for later use.
69
+
70
+
To extract the SAS key from a specific policy, select the **Copy** button next to the policy containing the SAS key you want. Paste this value into a temporary location, then copy the SAS key portion of the connection string. This example uses a Notification Hubs namespace called **mytestnamespace1**, and a policy named **policy2**. The SAS key is the value near the end of the string, specified by **SharedAccessKey**:
71
+
72
+
```shell
73
+
Endpoint=sb://mytestnamespace1.servicebus.windows.net/;SharedAccessKeyName=policy2;SharedAccessKey=<SAS key value here>
74
+
```
75
+
76
+

47
77
48
-
Notification Hubs accepts signature tokens generated with shared keys configured directly on the Notification Hub.
78
+
## Next steps
49
79
50
-
It is not possible to send a notification to more than one namespace. Namespaces are logical container for notification hubs and are not involved with sending notifications.
51
-
The namespace-level access policies (credentials) can be used for namespace-level operations, for example: listing notification hubs, creating or deleting notification hubs, etc. Only the hub-level access policies would let you send notifications.
0 commit comments