Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions eng/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
"Name": "eng/tools",
"CoverageGoal": 0.0
},
{
"Name": "keyvault/internal",
"CoverageGoal": 0.40
},
{
"Name": "internal",
"CoverageGoal": 0.70
Expand Down
2 changes: 1 addition & 1 deletion sdk/keyvault/internal/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Release History

## 0.1.0 (Unreleased)
## 0.1.0 (2021-11-09)
* This is the initial release of the `internal` library for KeyVault
21 changes: 21 additions & 0 deletions sdk/keyvault/internal/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Microsoft Corporation. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
3 changes: 3 additions & 0 deletions sdk/keyvault/internal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Internal for Key Vault SDKs

This module contains shared code for all the Key Vault SDKs, mainly the challenge authentication policy.
20 changes: 14 additions & 6 deletions sdk/keyvault/internal/challenge_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"fmt"
"net/http"
"testing"

"github.com/stretchr/testify/require"
)

var fakeTenant = "00000000-0000-0000-0000-000000000000"
Expand Down Expand Up @@ -41,7 +43,8 @@ func TestFindScopeAndTenant(t *testing.T) {
"WWW-Authenticate",
fmt.Sprintf(authResource, fakeTenant, mhsmResource),
)
p.findScopeAndTenant(&resp)
err := p.findScopeAndTenant(&resp)
require.NoError(t, err)
if *p.scope != mhsmScope {
t.Fatalf("scope was not properly parsed, got %s, expected %s", *p.scope, mhsmScope)
}
Expand All @@ -53,7 +56,8 @@ func TestFindScopeAndTenant(t *testing.T) {
"WWW-Authenticate",
fmt.Sprintf(authResourceScope, fakeTenant, resource, scope),
)
p.findScopeAndTenant(&resp)
err = p.findScopeAndTenant(&resp)
require.NoError(t, err)
if *p.scope != scope {
t.Fatalf("scope was not properly parsed, got %s, expected %s", *p.scope, scope)
}
Expand All @@ -65,7 +69,8 @@ func TestFindScopeAndTenant(t *testing.T) {
"WWW-Authenticate",
fmt.Sprintf(authScope, fakeTenant, scope),
)
p.findScopeAndTenant(&resp)
err = p.findScopeAndTenant(&resp)
require.NoError(t, err)
if *p.scope != scope {
t.Fatalf("scope was not properly parsed, got %s, expected %s", *p.scope, scope)
}
Expand All @@ -77,7 +82,8 @@ func TestFindScopeAndTenant(t *testing.T) {
"WWW-Authenticate",
fmt.Sprintf(resourceScopeAuth, mhsmResource, mhsmScope, fakeTenant),
)
p.findScopeAndTenant(&resp)
err = p.findScopeAndTenant(&resp)
require.NoError(t, err)
if *p.scope != mhsmScope {
t.Fatalf("scope was not properly parsed, got %s, expected %s", *p.scope, "https://vault.azure.net/.default")
}
Expand All @@ -89,7 +95,8 @@ func TestFindScopeAndTenant(t *testing.T) {
"WWW-Authenticate",
"Bearer authorization=\"https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000\", unimportantkey=\"unimportantvalue\" resource=\"https://vault.azure.net/.default\"",
)
p.findScopeAndTenant(&resp)
err = p.findScopeAndTenant(&resp)
require.NoError(t, err)
if *p.scope != scope {
t.Fatalf("scope was not properly parsed, got %s, expected %s", *p.scope, scope)
}
Expand All @@ -101,7 +108,8 @@ func TestFindScopeAndTenant(t *testing.T) {
"WWW-Authenticate",
"Bearer authorization=\"https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000\", unimportantkey=\"unimportantvalue\" resource=\"https://vault.azure.net/.default\" fakekey=\"fakevalue\" ",
)
p.findScopeAndTenant(&resp)
err = p.findScopeAndTenant(&resp)
require.NoError(t, err)
if *p.scope != "https://vault.azure.net/.default" {
t.Fatalf("scope was not properly parsed, got %s, expected %s", *p.scope, "https://vault.azure.net/.default")
}
Expand Down
28 changes: 28 additions & 0 deletions sdk/keyvault/internal/ci.keyvault.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
trigger:
branches:
include:
- main
- feature/*
- hotfix/*
- release/*
paths:
include:
- sdk/keyvault/internal

pr:
branches:
include:
- main
- feature/*
- hotfix/*
- release/*
paths:
include:
- sdk/keyvault/internal

stages:
- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml
parameters:
ServiceDirectory: 'keyvault/internal'
RunLiveTests: false
11 changes: 11 additions & 0 deletions sdk/keyvault/internal/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//go:build go1.16
// +build go1.16

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

package internal

const (
version = "v0.1.0" //nolint
)