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
97246fa7
Commit
97246fa7
authored
Jan 30, 2021
by
HFJ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add timestamp
parent
b71c7c92
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
52 deletions
+41
-52
src/impl/DefaultApiImpl.cpp
src/impl/DefaultApiImpl.cpp
+41
-52
No files found.
src/impl/DefaultApiImpl.cpp
View file @
97246fa7
...
...
@@ -48,6 +48,9 @@ uint8_t XRES_STAR[16]; //store xres*
// uint8_t KAUSF[32];
std
::
string
SUPI_AUSF
;
//store supi
std
::
string
AUTH_TYPE
;
//store authType
std
::
string
SERVING_NN
;
//store serving network name
std
::
string
KAUSF_TMP
;
//store Kausf(string)
typedef
struct
{
...
...
@@ -146,32 +149,28 @@ void DefaultApiImpl::ue_authentications_auth_ctx_id5g_aka_confirmation_put(
std
::
string
Method
;
std
::
string
Response
;
//UDM POST interface ----- get authentication related info--------------------
udmUri
=
"http://"
+
udm_ip
+
":"
+
udm_port
+
"/nudm-ueau/v1/"
+
SUPI_AUSF
+
"/auth-events"
;
cout
<<
udmUri
.
c_str
()
<<
endl
;
//udmUri = "http://192.168.21.136:8181/nudm-ueau/v1/imsi-460011111111111/auth-events";
Logger
::
ausf_server
().
debug
(
"POST Request:"
+
udmUri
);
Method
=
"POST"
;
//form udm request body
AuthInfo
//form udm request body
nlohmann
::
json
confirmResultInfo
=
{};
//form udm request body AuthInfo
//nfInstanceId
confirmResultInfo
[
"nfInstanceId"
]
=
"400346f4-087e-40b1-a4cd-00566953999d"
;
//fixed, may need to change
//success
confirmResultInfo
[
"success"
]
=
true
;
//timeStamp
confirmResultInfo
[
"timeStamp"
]
=
"2020-08-12T17:02:51.128672225+09:00"
;
//PARAM
//authType
confirmResultInfo
[
"authType"
]
=
"5G_AKA"
;
//PARAM
//servingNetworkName
confirmResultInfo
[
"servingNetworkName"
]
=
"5G:mnc001.mcc460.3gppnetwork.org"
;
//PARAM
//authRemovalInd
time_t
rawtime
;
time
(
&
rawtime
);
char
buf
[
32
];
strftime
(
buf
,
sizeof
(
buf
),
"%FT%TZ"
,
gmtime
(
&
rawtime
));
confirmResultInfo
[
"timeStamp"
]
=
buf
;
//PARAM
// confirmResultInfo["timeStamp"] = "2020-08-12T17:02:51.128672225+09:00"; //PARAM
confirmResultInfo
[
"authType"
]
=
AUTH_TYPE
;
//authType stored in ausf
confirmResultInfo
[
"servingNetworkName"
]
=
SERVING_NN
;
//snn stored in ausf
confirmResultInfo
[
"authRemovalInd"
]
=
false
;
cout
<<
confirmResultInfo
.
dump
()
<<
endl
;
Curl
::
curl_http_client
(
udmUri
,
Method
,
confirmResultInfo
.
dump
()
,
Response
);
}
...
...
@@ -198,7 +197,7 @@ void DefaultApiImpl::ue_authentications_deregister_post(
void
DefaultApiImpl
::
ue_authentications_post
(
const
AuthenticationInfo
&
authenticationInfo
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
Logger
::
ausf_server
().
debug
(
"--ue_authentications_post--"
);
/*----------------------getting params-------------*/
...
...
@@ -241,22 +240,17 @@ void DefaultApiImpl::ue_authentications_post(
}
cout
<<
response_data
.
dump
()
<<
endl
;
std
::
string
authType_udm
=
response_data
.
at
(
"authType"
);
std
::
string
authType_udm
=
response_data
.
at
(
"authType"
);
//AuthType
Logger
::
ausf_server
().
debug
(
"authType %s"
,
authType_udm
.
c_str
());
std
::
string
autn_udm
=
response_data
[
"authenticationVector"
].
at
(
"autn"
);
std
::
string
autn_udm
=
response_data
[
"authenticationVector"
].
at
(
"autn"
);
//autn
Logger
::
ausf_server
().
debug
(
"autn_udm %s"
,
autn_udm
.
c_str
());
std
::
string
avType_udm
=
response_data
[
"authenticationVector"
].
at
(
"avType"
);
std
::
string
avType_udm
=
response_data
[
"authenticationVector"
].
at
(
"avType"
);
//avType
Logger
::
ausf_server
().
debug
(
"avType_udm %s"
,
avType_udm
.
c_str
());
std
::
string
kausf_udm
=
response_data
[
"authenticationVector"
].
at
(
"kausf"
);
std
::
string
kausf_udm
=
response_data
[
"authenticationVector"
].
at
(
"kausf"
);
//kausf
Logger
::
ausf_server
().
debug
(
"kausf_udm %s"
,
kausf_udm
.
c_str
());
std
::
string
rand_udm
=
response_data
[
"authenticationVector"
].
at
(
"rand"
);
std
::
string
rand_udm
=
response_data
[
"authenticationVector"
].
at
(
"rand"
);
//rand
Logger
::
ausf_server
().
debug
(
"rand_udm %s"
,
rand_udm
.
c_str
());
std
::
string
xresStar_udm
=
response_data
[
"authenticationVector"
].
at
(
"xresStar"
);
std
::
string
xresStar_udm
=
response_data
[
"authenticationVector"
].
at
(
"xresStar"
);
//xres*
Logger
::
ausf_server
().
debug
(
"xres*_udm %s"
,
xresStar_udm
.
c_str
());
//------------------5G HE AV-----------------------------------------------------
...
...
@@ -300,38 +294,30 @@ void DefaultApiImpl::ue_authentications_post(
Authentication_5gaka
::
derive_kseaf
(
snn
,
kausf
,
kseaf
);
Logger
::
ausf_server
().
debug
(
"kseaf calculated:
\n
%s"
,
(
conv
::
uint8_to_hex_string
(
kseaf
,
32
)).
c_str
());
//store 5g av in ausf
memcpy
(
ausf_av_s
.
rand
,
rand_ausf
,
16
);
memcpy
(
ausf_av_s
.
rand
,
rand_ausf
,
16
);
//store 5g av in ausf
memcpy
(
ausf_av_s
.
autn
,
autn_ausf
,
16
);
memcpy
(
ausf_av_s
.
hxresStar
,
hxresStar
,
16
);
memcpy
(
ausf_av_s
.
kseaf
,
kseaf
,
32
);
memcpy
(
XRES_STAR
,
xresStar
,
16
);
//store xres* in ausf
SUPI_AUSF
=
authenticationInfo
.
getSupiOrSuci
();
//store supi in ausf
SERVING_NN
=
snn
;
//store snn in ausf
AUTH_TYPE
=
authType_udm
;
//store authType in ausf
KAUSF_TMP
=
conv
::
uint8_to_hex_string
(
kausf_ausf
,
32
);
//store kausf_tmp in ausf
//store supi in ausf
SUPI_AUSF
=
authenticationInfo
.
getSupiOrSuci
();
//store kausf_tmp in ausf
KAUSF_TMP
=
conv
::
uint8_to_hex_string
(
kausf_ausf
,
32
);
//store xres* for 5g-aka-confirmation
Logger
::
ausf_server
().
debug
(
"xres*_udm %s"
,
xresStar_udm
.
c_str
());
memcpy
(
XRES_STAR
,
xresStar
,
16
);
Logger
::
ausf_server
().
debug
(
"xres*_ausf %s"
,
conv
::
uint8_to_hex_string
(
XRES_STAR
,
16
).
c_str
());
/*----------------ausf --> seaf-----------*/
//---forming response
// convert uint8_t to string
string
rand_s
;
rand_s
=
conv
::
uint8_to_hex_string
(
rand_ausf
,
16
);
string
autn_s
;
autn_s
=
conv
::
uint8_to_hex_string
(
autn_ausf
,
16
);
string
hxresStar_s
;
hxresStar_s
=
conv
::
uint8_to_hex_string
(
hxresStar
,
16
);
//---form UEAuthenticationCtx
UEAuthenticationCtx
UEAuthCtx
;
//-------authType(string)
UEAuthCtx
.
setAuthType
(
authType_udm
);
//-------_links(std::map)
string
rand_s
=
conv
::
uint8_to_hex_string
(
rand_ausf
,
16
);
string
autn_s
=
conv
::
uint8_to_hex_string
(
autn_ausf
,
16
);
string
hxresStar_s
=
conv
::
uint8_to_hex_string
(
hxresStar
,
16
);
UEAuthCtx
.
setAuthType
(
authType_udm
);
//authType(string)
//links(std::map)
std
::
map
<
std
::
string
,
LinksValueSchema
>
ausf_links
;
LinksValueSchema
ausf_Href
;
std
::
string
resourceURI
;
...
...
@@ -347,8 +333,6 @@ void DefaultApiImpl::ue_authentications_post(
std
::
string
Location
=
resourceURI
;
// cout << ausf_Href.getHref().c_str() << endl;
ausf_links
[
"5G_AKA"
]
=
ausf_Href
;
UEAuthCtx
.
setLinks
(
ausf_links
);
...
...
@@ -360,6 +344,10 @@ void DefaultApiImpl::ue_authentications_post(
ausf_5gAuthData
.
setHxresStar
(
hxresStar_s
);
UEAuthCtx
.
setR5gAuthData
(
ausf_5gAuthData
);
Logger
::
ausf_server
().
debug
(
"autn_udm %s"
,
autn_udm
.
c_str
());
Logger
::
ausf_server
().
debug
(
"autn_ausf %s"
,
conv
::
uint8_to_hex_string
(
autn_ausf
,
16
).
c_str
());
Logger
::
ausf_server
().
debug
(
"autn_stored %s"
,
autn_s
.
c_str
());
nlohmann
::
json
UEAuthCtx_json
;
to_json
(
UEAuthCtx_json
,
UEAuthCtx
);
Logger
::
ausf_server
().
debug
(
"auth response:
\n
%s"
,
UEAuthCtx_json
.
dump
().
c_str
());
...
...
@@ -367,6 +355,7 @@ void DefaultApiImpl::ue_authentications_post(
Logger
::
ausf_server
().
info
(
"Send 201 response to SEAF"
);
response
.
headers
().
add
<
Pistache
::
Http
::
Header
::
Location
>
(
Location
);
response
.
send
(
Pistache
::
Http
::
Code
::
Created
,
UEAuthCtx_json
.
dump
());
//Type: json object to string
}
}
// namespace api
...
...
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