DotNetDupe
4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Toggle main menu visibility
Loading...
Searching...
No Matches
JWTToken.h
Go to the documentation of this file.
1
3
4
#pragma once
5
6
#include "
Common.h
"
7
#include "
System/Object.h
"
8
#include "
System/String.h
"
9
#include "
System/SmartPointer.h
"
10
#include "
System/Collections/Generic/Dictionary.h
"
11
12
namespace
DotNetDupe
{
13
namespace
System
{
14
namespace
IdentityModel
{
15
namespace
Tokens
{
16
namespace
Jwt
{
17
23
class
JWTToken
:
public
Object
{
24
public
:
26
DOTNETDUPE_API
JWTToken
();
27
29
DOTNETDUPE_API
~JWTToken
() =
default
;
30
33
DOTNETDUPE_API
Collections::Generic::Dictionary<String, String>
&
GetHeader
();
34
37
DOTNETDUPE_API
const
Collections::Generic::Dictionary<String, String>
&
GetHeader
()
const
;
38
41
DOTNETDUPE_API
Collections::Generic::Dictionary<String, String>
&
GetPayload
();
42
45
DOTNETDUPE_API
const
Collections::Generic::Dictionary<String, String>
&
GetPayload
()
const
;
46
49
DOTNETDUPE_API
String
GetSignature
()
const
;
50
54
DOTNETDUPE_API
String
CreateToken
(
const
String
& secretKey);
55
59
DOTNETDUPE_API
static
SmartPointer<JWTToken>
Parse
(
const
String
& tokenStr);
60
64
DOTNETDUPE_API
bool
Verify
(
const
String
& secretKey)
const
;
65
66
private
:
67
Collections::Generic::Dictionary<String, String>
m_header;
68
Collections::Generic::Dictionary<String, String>
m_payload;
69
String
m_signature;
70
String
m_rawTokenWithoutSignature;
71
};
72
73
}
74
}
75
}
76
}
77
}
Common.h
Defines common cross-platform macros, export decorators, and fundamental types.
DOTNETDUPE_API
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition
Common.h:20
Dictionary.h
Object.h
Base object class for DotNetDupe mirroring .NET System.Object.
SmartPointer.h
Provides reference-counted and weak pointer memory management primitives ensuring zero raw ownership.
String.h
High-performance UTF-8 / UTF-16 string manipulation class mirroring .NET System.String.
DotNetDupe::System::Collections::Generic::Dictionary
Represents a collection of keys and values.
Definition
Dictionary.h:66
DotNetDupe::System::IdentityModel::Tokens::Jwt::JWTToken::GetSignature
String GetSignature() const
Gets the cryptographic signature string component of the token.
Definition
JWTToken.cpp:68
DotNetDupe::System::IdentityModel::Tokens::Jwt::JWTToken::GetPayload
Collections::Generic::Dictionary< String, String > & GetPayload()
Gets a mutable reference to the payload claims dictionary.
Definition
JWTToken.cpp:58
DotNetDupe::System::IdentityModel::Tokens::Jwt::JWTToken::~JWTToken
~JWTToken()=default
Default virtual destructor.
DotNetDupe::System::IdentityModel::Tokens::Jwt::JWTToken::CreateToken
String CreateToken(const String &secretKey)
Encodes and cryptographically signs the token using HMAC-SHA256.
Definition
JWTToken.cpp:91
DotNetDupe::System::IdentityModel::Tokens::Jwt::JWTToken::Parse
static SmartPointer< JWTToken > Parse(const String &tokenStr)
Parses a serialized compact JWT string into a JWTToken instance.
Definition
JWTToken.cpp:108
DotNetDupe::System::IdentityModel::Tokens::Jwt::JWTToken::JWTToken
JWTToken()
Initializes a new instance of the JWTToken class with default header values.
Definition
JWTToken.cpp:42
DotNetDupe::System::IdentityModel::Tokens::Jwt::JWTToken::GetHeader
Collections::Generic::Dictionary< String, String > & GetHeader()
Gets a mutable reference to the JOSE header dictionary.
Definition
JWTToken.cpp:48
DotNetDupe::System::IdentityModel::Tokens::Jwt::JWTToken::Verify
bool Verify(const String &secretKey) const
Verifies the token signature against a specified secret key.
Definition
JWTToken.cpp:122
DotNetDupe::System::Object
Supports all classes in the DotNetDupe class hierarchy.
Definition
Object.h:18
DotNetDupe::System::SmartPointer
A unified smart pointer that supports both unique and shared ownership semantics.
Definition
SmartPointer.h:72
DotNetDupe::System::String
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Definition
String.h:74
DotNetDupe::System::IdentityModel::Tokens::Jwt
Definition
JWTToken.h:16
DotNetDupe::System::IdentityModel::Tokens
Definition
JWTToken.h:15
DotNetDupe::System::IdentityModel
Definition
JWTToken.h:14
DotNetDupe::System
Definition
Action.h:11
DotNetDupe
Definition
IServiceCollection.h:7
Include
System
IdentityModel
Tokens
Jwt
JWTToken.h
Generated by
1.18.0