Skip to content

Commit 9121e31

Browse files
committed
changes
1 parent 771cf3e commit 9121e31

File tree

18 files changed

+186
-194
lines changed

18 files changed

+186
-194
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
local-dotnet
21
bin/
32
obj/
43
dotnet-install.sh
54
build
65
# Ignore NuGet Packages
76
*.nupkg
87
.tox
9-
Deployment
8+
Deployment

.versionize

Lines changed: 0 additions & 31 deletions
This file was deleted.

NuGet.Config

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@
1616
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
1717

1818
<add key="local-feed" value="%NUGET_LOCAL_FEED_PATH%" />
19-
20-
<add key="github-nuget-otc" value="https://nuget.pkg.github.com/opentelekomcloud-community/index.json" />
19+
20+
<add key="github" value="https://nuget.pkg.github.com/opentelekomcloud-community/index.json" />
2121

2222
</packageSources>
2323

2424
<packageSourceCredentials>
25-
<github-nuget-otc>
25+
<github>
2626
<!-- <add key="Username" value="api-key" /> -->
2727
<add key="Username" value="%GITHUB_USERNAME%" />
2828
<add key="ClearTextPassword" value="%GITHUB_TOKEN%" />
29-
</github-nuget-otc>
29+
</github>
3030
</packageSourceCredentials>
3131

3232

buildtools/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# README.md 1
1+
# dummy

buildtools/build.proj

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@
22
<Project ToolsVersion="14.0" DefaultTargets="full-build"
33
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
44

5-
<Import Project="./common.props" />
5+
<PropertyGroup>
6+
<TargetFrameworks>net8.0;net6.0;netcoreapp3.1;netcoreapp2.1</TargetFrameworks>
7+
<NuGetAudit>false</NuGetAudit>
8+
<CheckEolTargetFramework>false</CheckEolTargetFramework>
9+
</PropertyGroup>
610

711
<PropertyGroup>
8-
<SOLUTION_FOLDER>$(MSBuildThisFileDirectory)../otc-api-sign-sdk-core</SOLUTION_FOLDER>
9-
<SOLUTION_NAME>otc-api-sign-sdk-core.sln</SOLUTION_NAME>
10-
<VERSIONIZE_PROJECT_NAME>otc-api-sign-sdk-core</VERSIONIZE_PROJECT_NAME>
12+
<SOLUTION_FOLDER>$(MSBuildThisFileDirectory)..</SOLUTION_FOLDER>
13+
<SOLUTION_NAME>otc-api-sign-sdk.sln</SOLUTION_NAME>
1114
</PropertyGroup>
1215

1316

1417
<PropertyGroup>
1518
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
16-
<SignAssembly Condition=" '$(SignAssembly)' == '' ">true</SignAssembly>
19+
<SignAssembly Condition="'$(SignAssembly)' == '' ">true</SignAssembly>
1720
</PropertyGroup>
1821

1922
<Target Name="full-build"
@@ -27,22 +30,22 @@
2730
<Target Name="build"
2831
DependsOnTargets="build-project-packages"></Target>
2932

30-
<ItemGroup>
31-
<LibraryName Include="$(SOLUTION_FOLDER)/src/**/*.csproj" />
32-
</ItemGroup>
33-
3433
<Target Name="init">
3534
<RemoveDir Directories="../Deployment" />
36-
<Exec Command="dotnet restore $(SOLUTION_NAME)" WorkingDirectory="$(SOLUTION_FOLDER)" />
35+
<Exec Command="dotnet restore $(SOLUTION_NAME)" WorkingDirectory=".." />
3736
</Target>
3837

3938
<Target Name="build-nuget-packages" DependsOnTargets="init">
4039
<Exec
4140
Command="dotnet build $(SOLUTION_NAME) /t:Rebuild /p:Configuration=$(Configuration) /p:AssemblyOriginatorKeyFile=$(AssemblyOriginatorKeyFile) /p:SignAssembly=$(SignAssembly)"
42-
WorkingDirectory="$(SOLUTION_FOLDER)" />
41+
WorkingDirectory=".." />
4342
<Exec
44-
Command="dotnet pack --no-build -c $(Configuration) -v d -o $(MSBuildThisFileDirectory)../Deployment/nuget-packages"
45-
WorkingDirectory="$(SOLUTION_FOLDER)/src" />
43+
Command="dotnet pack $(SOLUTION_NAME) \
44+
--no-build \
45+
--configuration $(Configuration) \
46+
--verbosity detailed \
47+
--output $(MSBuildThisFileDirectory)../Deployment/nuget-packages"
48+
WorkingDirectory=".." />
4649
</Target>
4750

4851
<Target Name="publish-nuget-local" DependsOnTargets="build-nuget-packages">
@@ -55,17 +58,9 @@
5558
StdOutEncoding="utf-8" />
5659
</Target>
5760

58-
59-
<Target Name="versionize" DependsOnTargets="build-nuget-packages">
60-
<Exec
61-
Command="versionize --skip-commit --skip-tag --workingDir $(SOLUTION_FOLDER) --proj-name &quot;$(VERSIONIZE_PROJECT_NAME)&quot;"
62-
WorkingDirectory="$(MSBuildProjectDirectory)"
63-
StdOutEncoding="utf-8" />
64-
</Target>
65-
66-
<Target Name="publish-nuget-github" DependsOnTargets="versionize">
61+
<Target Name="publish-nuget-github" DependsOnTargets="build-nuget-packages">
6762
<Exec
68-
Command="dotnet nuget push &quot;$(MSBuildThisFileDirectory)../Deployment/nuget-packages/*.nupkg&quot; --source &quot;github-nuget-otc&quot; --skip-duplicate"
63+
Command="dotnet nuget push &quot;$(MSBuildThisFileDirectory)../Deployment/nuget-packages/*.nupkg&quot; --source &quot;github&quot; --skip-duplicate"
6964
WorkingDirectory="$(MSBuildProjectDirectory)"
7065
StdOutEncoding="utf-8" />
7166
</Target>

doc/source/installation/_index.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Installation
77

88
The latest state of the module can be installed directly from the GitHub repository.
99

10+
TBD.
11+
1012

1113
Install dotnet on Ubuntu
1214
------------------------
@@ -18,19 +20,25 @@ Install dotnet on Ubuntu
1820
1921
chmod +x ./dotnet-install.sh
2022
21-
./dotnet-install.sh --channel 6.0 --install-dir local-dotnet --skip-non-versioned-files
23+
mkdir -p ~/dotnet
24+
25+
./dotnet-install.sh --channel 8.0 --install-dir ~/dotnet --skip-non-versioned-files
26+
27+
./dotnet-install.sh --channel 6.0 --install-dir ~/dotnet --skip-non-versioned-files
2228
23-
./dotnet-install.sh --channel 3.1 --install-dir local-dotnet --skip-non-versioned-files
29+
./dotnet-install.sh --channel 3.1 --install-dir ~/dotnet --skip-non-versioned-files
2430
25-
./dotnet-install.sh --channel 2.1 --install-dir local-dotnet --skip-non-versioned-files
31+
./dotnet-install.sh --channel 2.1 --install-dir ~/dotnet --skip-non-versioned-files
32+
33+
export DOTNET_ROOT=~/dotnet
34+
export PATH=$DOTNET_ROOT:$PATH
2635
2736
to build use
2837

2938
.. code-block:: shell
3039
:caption: install dotnet
3140
32-
./local-dotnet/dotnet build
33-
41+
dotnet build
3442
3543
3644
Installation using NuGet:

doc/source/samples/aksk/ecs-start/_index.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ Installation and Running
4444
.. code-block:: bash
4545
:caption: Install and run the sample
4646
47-
../../../local-dotnet/dotnet build
47+
cd samples-doc/aksksigning/ecs-start
48+
49+
dotnet build
4850
4951
# Running the sample with framework net6.0
50-
../../../local-dotnet/dotnet run --project ecs-start.csproj --framework net6.0
52+
dotnet run --project ecs-start.csproj --framework net6.0
5153

otc-api-sign-sdk-core/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# OpenTelekomCloud-Community-API-sign-sdk
2+
3+
4+
OpenTelekomCloud Community SDK for signing API requests using C#.
5+
6+
For documentation see: [Developer Guide](https://opentelekomcloud-community.github.io/otc-api-sign-sdk-csharp/)
Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
namespace OpenTelekomCloud.API.Signing.Core
1313
{
14+
/// <summary>
15+
/// HttpRequest represents a HTTP request to be signed
16+
/// </summary>
1417
public class HttpRequest
1518
{
1619
public string method;
@@ -21,6 +24,14 @@ public class HttpRequest
2124
public string body = "";
2225
public string canonicalRequest;
2326
public string stringToSign;
27+
28+
/// <summary>
29+
/// Initialize HttpRequest
30+
/// </summary>
31+
/// <param name="method"></param>
32+
/// <param name="url"></param>
33+
/// <param name="headers"></param>
34+
/// <param name="body"></param>
2435
public HttpRequest(string method = "GET", Uri url = null, WebHeaderCollection headers = null, string body = null)
2536
{
2637
if (method != null)
@@ -64,6 +75,10 @@ public HttpRequest(string method = "GET", Uri url = null, WebHeaderCollection he
6475
}
6576
}
6677
}
78+
79+
/// <summary>
80+
/// Signer signs HTTP requests with OTC API Signature
81+
/// </summary>
6782
public partial class Signer
6883
{
6984
const string BasicDateFormat = "yyyyMMddTHHmmssZ";
@@ -92,17 +107,30 @@ public string AppSecret
92107
get => secret;
93108
set => secret = value;
94109
}
110+
/// <summary>
111+
/// AccessKey or SecurityAccessKey
112+
/// </summary>
95113
public string Key
96114
{
97115
get => key;
98116
set => key = value;
99117
}
118+
/// <summary>
119+
/// SecretKey or SecuritySecretKey
120+
/// </summary>
100121
public string Secret
101122
{
102123
get => secret;
103124
set => secret = value;
104125
}
105126

127+
/// <summary>
128+
/// <para>
129+
/// Security Token for temporary credentials
130+
/// </para>
131+
/// If set it will be added to signed requests
132+
/// as header "X-Security-Token"
133+
/// </summary>
106134
public string SecurityToken
107135
{
108136
get => securityToken;
@@ -118,15 +146,22 @@ byte[] hmacsha256(byte[] keyByte, string message)
118146
}
119147
}
120148

121-
// Build a CanonicalRequest from a regular request string
122-
//
123-
// CanonicalRequest =
124-
// HTTPRequestMethod + '\n' +
125-
// CanonicalURI + '\n' +
126-
// CanonicalQueryString + '\n' +
127-
// CanonicalHeaders + '\n' +
128-
// SignedHeaders + '\n' +
129-
// HexEncode(Hash(RequestPayload))
149+
/// <summary>
150+
/// Build a CanonicalRequest from a regular request string
151+
///
152+
/// <para>
153+
/// CanonicalRequest =
154+
/// HTTPRequestMethod + '\n' + <br/>
155+
/// CanonicalURI + '\n' + <br/>
156+
/// CanonicalQueryString + '\n' +<br/>
157+
/// CanonicalHeaders + '\n' +<br/>
158+
/// SignedHeaders + '\n' + <br/>
159+
/// HexEncode(Hash(RequestPayload))<br/>
160+
/// </para>
161+
/// </summary>
162+
/// <param name="r"></param>
163+
/// <param name="signedHeaders"></param>
164+
/// <returns></returns>
130165
string CanonicalRequest(HttpRequest r, List<string> signedHeaders)
131166
{
132167
string hexencode;

0 commit comments

Comments
 (0)