Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AUSF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-AUSF
Commits
94ce9678
Commit
94ce9678
authored
Jan 29, 2021
by
HFJ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ue_authentications fixed
parent
908d873b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
17 deletions
+58
-17
src/impl/DefaultApiImpl.cpp
src/impl/DefaultApiImpl.cpp
+53
-12
src/model/UEAuthenticationCtx.cpp
src/model/UEAuthenticationCtx.cpp
+2
-2
src/model/UEAuthenticationCtx.h
src/model/UEAuthenticationCtx.h
+3
-3
No files found.
src/impl/DefaultApiImpl.cpp
View file @
94ce9678
...
...
@@ -21,10 +21,15 @@
#include "conversions.hpp"
#include "sha256.hpp"
#include "
Av5gAka
.h"
#include "
UEAuthenticationCtx
.h"
#include "ConfirmationDataResponse.h"
#include <typeinfo>
#include <map>
#include "ausf_config.hpp"
using
namespace
config
;
extern
ausf_config
ausf_cfg
;
using
namespace
std
;
...
...
@@ -38,7 +43,8 @@ using namespace org::openapitools::server::model;
//stored temporarily
uint8_t
XRES_STAR
[
16
];
//store xres*
uint8_t
KSEAF
[
32
];
// uint8_t KSEAF[32];
uint8_t
kAUSF
[
32
];
typedef
struct
{
uint8_t
rand
[
16
];
...
...
@@ -233,19 +239,54 @@ void DefaultApiImpl::ue_authentications_post(
string
hxresStar_s
;
hxresStar_s
=
conv
::
uint8_to_hex_string
(
hxresStar
,
16
);
// convert to json
Av5gAka
AuthResponse
;
AuthResponse
.
setRand
(
rand_s
);
AuthResponse
.
setAutn
(
autn_s
);
AuthResponse
.
setHxresStar
(
hxresStar_s
);
nlohmann
::
json
AuthResponse_json
;
to_json
(
AuthResponse_json
,
AuthResponse
);
Logger
::
ausf_server
().
debug
(
"auth response:
\n
%s"
,
AuthResponse_json
.
dump
().
c_str
());
// nlohmann::json AuthInfoResult = {};
// AuthInfoResult["authType"] = "5G_AKA";
// AuthInfoResult["_links"] = "5G_AKA";
// AuthInfoResult["5gAuthData"]["avType"] = "5G_SE_AKA";
// AuthInfoResult["5gAuthData"]["rand"] = rand_s;
// AuthInfoResult["5gAuthData"]["autn"] = autn_s;
// AuthInfoResult["5gAuthData"]["hxresStar"] = hxresStar_s;
// Logger::ausf_server().debug("auth response:\n %s",AuthInfoResult.dump().c_str());
// Logger::ausf_server().info("Send response to seaf");
// response.send(Pistache::Http::Code::Created, AuthInfoResult.dump());
UEAuthenticationCtx
UEAuthCtx
;
//-------authType(string)
UEAuthCtx
.
setAuthType
(
"5G_AKA"
);
//-------_links(std::map)
std
::
map
<
std
::
string
,
LinksValueSchema
>
ausf_links
;
LinksValueSchema
ausf_Href
;
std
::
string
resourceURI
;
std
::
string
authCtxId
;
std
::
string
ausf_ip
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
ausf_cfg
.
nudr
.
addr4
)));
std
::
string
ausf_port
=
std
::
to_string
(
ausf_cfg
.
sbi
.
port
);
authCtxId
=
supi
;
//unsecure, supi leaked
resourceURI
=
"http://"
+
ausf_ip
+
":"
+
ausf_port
+
"/nausf-auth/v1/ue-authentications/"
+
authCtxId
+
"/5g-aka-confirmation"
;
ausf_Href
.
setHref
(
resourceURI
);
//"/nausf-auth/v1/ue-authentications/640110987654321/5g-aka-confirmation"
cout
<<
ausf_Href
.
getHref
().
c_str
()
<<
endl
;
ausf_links
[
"5g_aka_confirmation_put"
]
=
ausf_Href
;
UEAuthCtx
.
setLinks
(
ausf_links
);
//----------5gAuthData(Av5gAka):rand autn hxresStar
Av5gAka
ausf_5gAuthData
;
ausf_5gAuthData
.
setRand
(
rand_s
);
ausf_5gAuthData
.
setAutn
(
autn_s
);
ausf_5gAuthData
.
setHxresStar
(
hxresStar_s
);
UEAuthCtx
.
setR5gAuthData
(
ausf_5gAuthData
);
nlohmann
::
json
UEAuthCtx_json
;
to_json
(
UEAuthCtx_json
,
UEAuthCtx
);
Logger
::
ausf_server
().
debug
(
"auth response:
\n
%s"
,
UEAuthCtx_json
.
dump
().
c_str
());
Logger
::
ausf_server
().
info
(
"Send response to SEAF"
);
response
.
send
(
Pistache
::
Http
::
Code
::
Created
,
AuthResponse
_json
.
dump
());
//Type: json object to string
response
.
send
(
Pistache
::
Http
::
Code
::
Created
,
UEAuthCtx
_json
.
dump
());
//Type: json object to string
}
}
// namespace api
...
...
src/model/UEAuthenticationCtx.cpp
View file @
94ce9678
...
...
@@ -56,11 +56,11 @@ void from_json(const nlohmann::json& j, UEAuthenticationCtx& o)
}
}
AuthType
UEAuthenticationCtx
::
getAuthType
()
const
std
::
string
UEAuthenticationCtx
::
getAuthType
()
const
{
return
m_AuthType
;
}
void
UEAuthenticationCtx
::
setAuthType
(
AuthType
const
&
value
)
void
UEAuthenticationCtx
::
setAuthType
(
std
::
string
const
&
value
)
{
m_AuthType
=
value
;
}
...
...
src/model/UEAuthenticationCtx.h
View file @
94ce9678
...
...
@@ -49,8 +49,8 @@ public:
/// <summary>
///
/// </summary>
AuthType
getAuthType
()
const
;
void
setAuthType
(
AuthType
const
&
value
);
std
::
string
getAuthType
()
const
;
void
setAuthType
(
std
::
string
const
&
value
);
/// <summary>
///
/// </summary>
...
...
@@ -72,7 +72,7 @@ public:
friend
void
to_json
(
nlohmann
::
json
&
j
,
const
UEAuthenticationCtx
&
o
);
friend
void
from_json
(
const
nlohmann
::
json
&
j
,
UEAuthenticationCtx
&
o
);
protected:
AuthType
m_AuthType
;
std
::
string
m_AuthType
;
Av5gAka
m_r_5gAuthData
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment