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
b71c7c92
Commit
b71c7c92
authored
Jan 29, 2021
by
HFJ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add basic udm confirmation post
parent
bbe21d53
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
8 deletions
+52
-8
src/impl/DefaultApiImpl.cpp
src/impl/DefaultApiImpl.cpp
+52
-8
No files found.
src/impl/DefaultApiImpl.cpp
View file @
b71c7c92
...
...
@@ -94,7 +94,7 @@ void DefaultApiImpl::ue_authentications_auth_ctx_id5g_aka_confirmation_put(
uint8_t
authCtxId_seaf
[
16
];
conv
::
hex_str_to_uint8
(
authCtxId
.
c_str
(),
authCtxId_seaf
);
//authCtxId in seaf
Logger
::
ausf_server
().
debug
(
"authCtxId in ausf:
\n
%s"
,
(
conv
::
uint8_to_hex_string
(
ausf_av_s
.
autn
,
16
)).
c_str
());
Logger
::
ausf_server
().
debug
(
"authCtxId in ausf: %s"
,
(
conv
::
uint8_to_hex_string
(
ausf_av_s
.
autn
,
16
)).
c_str
());
bool
is_auth_vectors_present
=
Authentication_5gaka
::
equal_uint8
(
ausf_av_s
.
autn
,
authCtxId_seaf
,
16
);
if
(
!
is_auth_vectors_present
)
//AV expired
...
...
@@ -113,7 +113,8 @@ void DefaultApiImpl::ue_authentications_auth_ctx_id5g_aka_confirmation_put(
//get stored xres* -----
uint8_t
xresStar
[
16
]
=
{
0
};
memcpy
(
xresStar
,
XRES_STAR
,
16
);
//xres* stored for 5g-aka-confirmation
Logger
::
ausf_server
().
debug
(
"xres* in ausf:
\n
%s"
,
(
conv
::
uint8_to_hex_string
(
xresStar
,
16
)).
c_str
());
Logger
::
ausf_server
().
debug
(
"xres* in ausf: %s"
,
(
conv
::
uint8_to_hex_string
(
xresStar
,
16
)).
c_str
());
Logger
::
ausf_server
().
debug
(
"xres in amf: %s"
,
(
conv
::
uint8_to_hex_string
(
resStar
,
16
)).
c_str
());
bool
authResult
=
Authentication_5gaka
::
equal_uint8
(
xresStar
,
resStar
,
16
);
confirmResponse
.
setAuthResult
(
authResult
);
//3.向SEAF指示,从本地网络角度认证是否成功
...
...
@@ -131,11 +132,48 @@ void DefaultApiImpl::ue_authentications_auth_ctx_id5g_aka_confirmation_put(
kseaf_s
=
conv
::
uint8_to_hex_string
(
ausf_av_s
.
kseaf
,
32
);
// convert uint8_t to string
confirmResponse
.
setKseaf
(
kseaf_s
);
//send supi when supi_ausf exists
//
5.
send supi when supi_ausf exists
if
(
!
SUPI_AUSF
.
empty
())
{
confirmResponse
.
setSupi
(
SUPI_AUSF
);
}
//6. send authResult to udm
//UDM POST interface ----- send authentication result info--------------------
std
::
string
udm_ip
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
ausf_cfg
.
nudm
.
addr4
)));
//need to change to nudm
std
::
string
udm_port
=
std
::
to_string
(
ausf_cfg
.
nudm
.
port
);
std
::
string
udmUri
;
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
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
confirmResultInfo
[
"authRemovalInd"
]
=
false
;
cout
<<
confirmResultInfo
.
dump
()
<<
endl
;
Curl
::
curl_http_client
(
udmUri
,
Method
,
confirmResultInfo
.
dump
()
,
Response
);
}
}
...
...
@@ -145,7 +183,7 @@ void DefaultApiImpl::ue_authentications_auth_ctx_id5g_aka_confirmation_put(
to_json
(
confirmResponse_json
,
confirmResponse
);
Logger
::
ausf_server
().
debug
(
"5g-aka-confirmation response:
\n
%s"
,
confirmResponse_json
.
dump
().
c_str
());
Logger
::
ausf_server
().
info
(
"Send 5g-aka-confirmation response to SEAF"
);
Logger
::
ausf_server
().
info
(
"Send 5g-aka-confirmation
200
response to SEAF"
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
confirmResponse_json
.
dump
());
...
...
@@ -181,11 +219,10 @@ void DefaultApiImpl::ue_authentications_post(
//UDM POST interface ----- get authentication related info--------------------
udmUri
=
"http://"
+
udm_ip
+
":"
+
udm_port
+
"/nudm-ueau/v1/"
+
supi
+
"/security-information/generate-auth-data"
;
//udmUri = "http://192.168.21.134:8181/nudm-ueau/v1/imsi-460011111111111/security-information/generate-auth-data";
Logger
::
ausf_server
().
debug
(
"POST Request:"
+
udmUri
);
Method
=
"POST"
;
//form udm request body AuthIn
s
o
//form udm request body AuthIn
f
o
nlohmann
::
json
AuthInfo
=
{};
//model AuthenticationInfo do not have ausfInstanceId field
AuthInfo
[
"servingNetworkName"
]
=
snn
;
AuthInfo
[
"ausfInstanceId"
]
=
"400346f4-087e-40b1-a4cd-00566953999d"
;
//fixed, may need to change
...
...
@@ -220,7 +257,7 @@ void DefaultApiImpl::ue_authentications_post(
Logger
::
ausf_server
().
debug
(
"rand_udm %s"
,
rand_udm
.
c_str
());
std
::
string
xresStar_udm
=
response_data
[
"authenticationVector"
].
at
(
"xresStar"
);
Logger
::
ausf_server
().
debug
(
"xres
Star_udm %s"
,
autn
_udm
.
c_str
());
Logger
::
ausf_server
().
debug
(
"xres
*_udm %s"
,
xresStar
_udm
.
c_str
());
//------------------5G HE AV-----------------------------------------------------
uint8_t
autn
[
16
]
=
{
0
};
...
...
@@ -276,7 +313,9 @@ void DefaultApiImpl::ue_authentications_post(
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
...
...
@@ -306,6 +345,10 @@ void DefaultApiImpl::ue_authentications_post(
resourceURI
=
"http://"
+
ausf_ip
+
":"
+
ausf_port
+
"/nausf-auth/v1/ue-authentications/"
+
authCtxId_s
+
"/5g-aka-confirmation"
;
ausf_Href
.
setHref
(
resourceURI
);
//"/nausf-auth/v1/ue-authentications/640110987654321/5g-aka-confirmation"
std
::
string
Location
=
resourceURI
;
// cout << ausf_Href.getHref().c_str() << endl;
ausf_links
[
"5G_AKA"
]
=
ausf_Href
;
UEAuthCtx
.
setLinks
(
ausf_links
);
...
...
@@ -321,7 +364,8 @@ void DefaultApiImpl::ue_authentications_post(
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"
);
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
}
...
...
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