Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-NRF
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-NRF
Commits
240bfc95
Commit
240bfc95
authored
Dec 27, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add files for NRF_AccessToken
parent
f26c2640
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1322 additions
and
1 deletion
+1322
-1
src/api-server/api/AccessTokenRequestApi.cpp
src/api-server/api/AccessTokenRequestApi.cpp
+68
-0
src/api-server/api/AccessTokenRequestApi.h
src/api-server/api/AccessTokenRequestApi.h
+72
-0
src/api-server/impl/AccessTokenRequestApiImpl.cpp
src/api-server/impl/AccessTokenRequestApiImpl.cpp
+40
-0
src/api-server/impl/AccessTokenRequestApiImpl.h
src/api-server/impl/AccessTokenRequestApiImpl.h
+64
-0
src/api-server/model/AccessTokenClaims.cpp
src/api-server/model/AccessTokenClaims.cpp
+151
-0
src/api-server/model/AccessTokenClaims.h
src/api-server/model/AccessTokenClaims.h
+201
-0
src/api-server/model/AccessTokenErr.cpp
src/api-server/model/AccessTokenErr.cpp
+110
-0
src/api-server/model/AccessTokenErr.h
src/api-server/model/AccessTokenErr.h
+78
-0
src/api-server/model/AccessTokenReq.cpp
src/api-server/model/AccessTokenReq.cpp
+206
-0
src/api-server/model/AccessTokenReq.h
src/api-server/model/AccessTokenReq.h
+121
-0
src/api-server/model/AccessTokenRsp.cpp
src/api-server/model/AccessTokenRsp.cpp
+121
-0
src/api-server/model/AccessTokenRsp.h
src/api-server/model/AccessTokenRsp.h
+85
-0
src/api-server/nrf-api-server.cpp
src/api-server/nrf-api-server.cpp
+1
-0
src/api-server/nrf-api-server.h
src/api-server/nrf-api-server.h
+4
-1
No files found.
src/api-server/api/AccessTokenRequestApi.cpp
0 → 100644
View file @
240bfc95
/**
* NRF OAuth2
* NRF OAuth2 Authorization. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.0.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "AccessTokenRequestApi.h"
#include "Helpers.h"
#include "nrf_config.hpp"
extern
oai
::
nrf
::
app
::
nrf_config
nrf_cfg
;
namespace
oai
{
namespace
nrf
{
namespace
api
{
using
namespace
oai
::
nrf
::
helpers
;
using
namespace
oai
::
nrf
::
model
;
AccessTokenRequestApi
::
AccessTokenRequestApi
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
)
{
router
=
rtr
;
}
void
AccessTokenRequestApi
::
init
()
{
setupRoutes
();
}
void
AccessTokenRequestApi
::
setupRoutes
()
{
using
namespace
Pistache
::
Rest
;
Routes
::
Post
(
*
router
,
base
+
nrf_cfg
.
sbi_api_version
+
"/oauth2/token"
,
Routes
::
bind
(
&
AccessTokenRequestApi
::
access_token_request_handler
,
this
));
// Default handler, called when a route is not found
router
->
addCustomHandler
(
Routes
::
bind
(
&
AccessTokenRequestApi
::
access_token_request_api_default_handler
,
this
));
}
void
AccessTokenRequestApi
::
access_token_request_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
)
{
try
{
this
->
access_token_request
(
request
,
response
);
}
catch
(
nlohmann
::
detail
::
exception
&
e
)
{
//send a 400 error
response
.
send
(
Pistache
::
Http
::
Code
::
Bad_Request
,
e
.
what
());
return
;
}
catch
(
Pistache
::
Http
::
HttpError
&
e
)
{
response
.
send
(
static_cast
<
Pistache
::
Http
::
Code
>
(
e
.
code
()),
e
.
what
());
return
;
}
catch
(
std
::
exception
&
e
)
{
//send a 500 error
response
.
send
(
Pistache
::
Http
::
Code
::
Internal_Server_Error
,
e
.
what
());
return
;
}
}
void
AccessTokenRequestApi
::
access_token_request_api_default_handler
(
const
Pistache
::
Rest
::
Request
&
,
Pistache
::
Http
::
ResponseWriter
response
)
{
response
.
send
(
Pistache
::
Http
::
Code
::
Not_Found
,
"The requested method does not exist"
);
}
}
}
}
src/api-server/api/AccessTokenRequestApi.h
0 → 100644
View file @
240bfc95
/**
* NRF OAuth2
* NRF OAuth2 Authorization. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.0.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* AccessTokenRequestApi.h
*
*
*/
#ifndef AccessTokenRequestApi_H_
#define AccessTokenRequestApi_H_
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
#include "AccessTokenErr.h"
#include "AccessTokenRsp.h"
#include "NFType.h"
#include "PlmnId.h"
#include "ProblemDetails.h"
#include <string>
namespace
oai
{
namespace
nrf
{
namespace
api
{
using
namespace
oai
::
nrf
::
model
;
class
AccessTokenRequestApi
{
public:
AccessTokenRequestApi
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
);
virtual
~
AccessTokenRequestApi
()
{}
void
init
();
const
std
::
string
base
=
""
;
private:
void
setupRoutes
();
void
access_token_request_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
);
void
access_token_request_api_default_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
);
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
router
;
/// <summary>
/// Access Token Request
/// </summary>
/// <remarks>
///
/// </remarks>
virtual
void
access_token_request
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
&
response
)
=
0
;
};
}
}
}
#endif
/* AccessTokenRequestApi_H_ */
src/api-server/impl/AccessTokenRequestApiImpl.cpp
0 → 100644
View file @
240bfc95
/**
* NRF OAuth2
* NRF OAuth2 Authorization. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.0.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "AccessTokenRequestApiImpl.h"
namespace
oai
{
namespace
nrf
{
namespace
api
{
using
namespace
oai
::
nrf
::
model
;
using
namespace
oai
::
nrf
::
app
;
AccessTokenRequestApiImpl
::
AccessTokenRequestApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
,
nrf_app
*
nrf_app_inst
,
std
::
string
address
)
:
AccessTokenRequestApi
(
rtr
),
m_nrf_app
(
nrf_app_inst
),
m_address
(
address
)
{
}
void
AccessTokenRequestApiImpl
::
access_token_request
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"Do some magic
\n
"
);
}
}
}
}
src/api-server/impl/AccessTokenRequestApiImpl.h
0 → 100644
View file @
240bfc95
/**
* NRF OAuth2
* NRF OAuth2 Authorization. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.0.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* AccessTokenRequestApiImpl.h
*
*
*/
#ifndef ACCESS_TOKEN_REQUEST_API_IMPL_H_
#define ACCESS_TOKEN_REQUEST_API_IMPL_H_
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <AccessTokenRequestApi.h>
#include <pistache/optional.h>
#include "AccessTokenErr.h"
#include "AccessTokenRsp.h"
#include "NFType.h"
#include "PlmnId.h"
#include "ProblemDetails.h"
#include "nrf_app.hpp"
#include <string>
namespace
oai
{
namespace
nrf
{
namespace
api
{
using
namespace
oai
::
nrf
::
model
;
using
namespace
oai
::
nrf
::
app
;
class
AccessTokenRequestApiImpl
:
public
oai
::
nrf
::
api
::
AccessTokenRequestApi
{
public:
AccessTokenRequestApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
,
nrf_app
*
nrf_app_inst
,
std
::
string
address
);
~
AccessTokenRequestApiImpl
()
{
}
void
access_token_request
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
&
response
);
private:
nrf_app
*
m_nrf_app
;
std
::
string
m_address
;
};
}
}
}
#endif
src/api-server/model/AccessTokenClaims.cpp
0 → 100644
View file @
240bfc95
/**
* NRF OAuth2
* NRF OAuth2 Authorization. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.0.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "AccessTokenClaims.h"
namespace
oai
{
namespace
nrf
{
namespace
model
{
AccessTokenClaims
::
AccessTokenClaims
()
{
m_Iss
=
""
;
m_Sub
=
""
;
m_Scope
=
""
;
m_Exp
=
0
;
m_ConsumerPlmnIdIsSet
=
false
;
m_ProducerPlmnIdIsSet
=
false
;
}
AccessTokenClaims
::~
AccessTokenClaims
()
{
}
void
AccessTokenClaims
::
validate
()
{
// TODO: implement validation
}
void
to_json
(
nlohmann
::
json
&
j
,
const
AccessTokenClaims
&
o
)
{
j
=
nlohmann
::
json
();
j
[
"iss"
]
=
o
.
m_Iss
;
j
[
"sub"
]
=
o
.
m_Sub
;
j
[
"aud"
]
=
o
.
m_Aud
;
j
[
"scope"
]
=
o
.
m_Scope
;
j
[
"exp"
]
=
o
.
m_Exp
;
if
(
o
.
consumerPlmnIdIsSet
())
j
[
"consumerPlmnId"
]
=
o
.
m_ConsumerPlmnId
;
if
(
o
.
producerPlmnIdIsSet
())
j
[
"producerPlmnId"
]
=
o
.
m_ProducerPlmnId
;
}
void
from_json
(
const
nlohmann
::
json
&
j
,
AccessTokenClaims
&
o
)
{
j
.
at
(
"iss"
).
get_to
(
o
.
m_Iss
);
j
.
at
(
"sub"
).
get_to
(
o
.
m_Sub
);
j
.
at
(
"aud"
).
get_to
(
o
.
m_Aud
);
j
.
at
(
"scope"
).
get_to
(
o
.
m_Scope
);
j
.
at
(
"exp"
).
get_to
(
o
.
m_Exp
);
if
(
j
.
find
(
"consumerPlmnId"
)
!=
j
.
end
())
{
j
.
at
(
"consumerPlmnId"
).
get_to
(
o
.
m_ConsumerPlmnId
);
o
.
m_ConsumerPlmnIdIsSet
=
true
;
}
if
(
j
.
find
(
"producerPlmnId"
)
!=
j
.
end
())
{
j
.
at
(
"producerPlmnId"
).
get_to
(
o
.
m_ProducerPlmnId
);
o
.
m_ProducerPlmnIdIsSet
=
true
;
}
}
std
::
string
AccessTokenClaims
::
getIss
()
const
{
return
m_Iss
;
}
void
AccessTokenClaims
::
setIss
(
std
::
string
const
&
value
)
{
m_Iss
=
value
;
}
std
::
string
AccessTokenClaims
::
getSub
()
const
{
return
m_Sub
;
}
void
AccessTokenClaims
::
setSub
(
std
::
string
const
&
value
)
{
m_Sub
=
value
;
}
audience_t
AccessTokenClaims
::
getAud
()
const
{
return
m_Aud
;
}
void
AccessTokenClaims
::
setAud
(
audience_t
const
&
value
)
{
m_Aud
=
value
;
}
std
::
string
AccessTokenClaims
::
getScope
()
const
{
return
m_Scope
;
}
void
AccessTokenClaims
::
setScope
(
std
::
string
const
&
value
)
{
m_Scope
=
value
;
}
int32_t
AccessTokenClaims
::
getExp
()
const
{
return
m_Exp
;
}
void
AccessTokenClaims
::
setExp
(
int32_t
const
value
)
{
m_Exp
=
value
;
}
PlmnId
AccessTokenClaims
::
getConsumerPlmnId
()
const
{
return
m_ConsumerPlmnId
;
}
void
AccessTokenClaims
::
setConsumerPlmnId
(
PlmnId
const
&
value
)
{
m_ConsumerPlmnId
=
value
;
m_ConsumerPlmnIdIsSet
=
true
;
}
bool
AccessTokenClaims
::
consumerPlmnIdIsSet
()
const
{
return
m_ConsumerPlmnIdIsSet
;
}
void
AccessTokenClaims
::
unsetConsumerPlmnId
()
{
m_ConsumerPlmnIdIsSet
=
false
;
}
PlmnId
AccessTokenClaims
::
getProducerPlmnId
()
const
{
return
m_ProducerPlmnId
;
}
void
AccessTokenClaims
::
setProducerPlmnId
(
PlmnId
const
&
value
)
{
m_ProducerPlmnId
=
value
;
m_ProducerPlmnIdIsSet
=
true
;
}
bool
AccessTokenClaims
::
producerPlmnIdIsSet
()
const
{
return
m_ProducerPlmnIdIsSet
;
}
void
AccessTokenClaims
::
unsetProducerPlmnId
()
{
m_ProducerPlmnIdIsSet
=
false
;
}
}
}
}
src/api-server/model/AccessTokenClaims.h
0 → 100644
View file @
240bfc95
/**
* NRF OAuth2
* NRF OAuth2 Authorization. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.0.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* AccessTokenClaims.h
*
*
*/
#ifndef AccessTokenClaims_H_
#define AccessTokenClaims_H_
#include <string>
//#include "AnyOfNFTypearray.h"
#include "PlmnId.h"
#include <nlohmann/json.hpp>
namespace
oai
{
namespace
nrf
{
namespace
model
{
/// <summary>
///
/// </summary>
typedef
struct
audience_s
{
uint8_t
type
;
union
{
uint8_t
nf_type
;
std
::
vector
<
std
::
string
>
nf_instances
;
};
audience_s
()
:
type
(
0
)
{
nf_type
=
0
;
}
audience_s
(
uint8_t
t
)
:
type
(
t
)
{
nf_type
=
0
;
}
;
audience_s
(
const
audience_s
&
a
)
:
audience_s
()
{
type
=
a
.
type
;
switch
(
a
.
type
)
{
case
0
:
nf_type
=
a
.
nf_type
;
break
;
case
1
:
nf_instances
=
a
.
nf_instances
;
break
;
default:
break
;
}
}
audience_s
&
operator
=
(
const
audience_s
&
a
)
{
type
=
a
.
type
;
switch
(
a
.
type
)
{
case
0
:
{
nf_type
=
a
.
nf_type
;
}
break
;
case
1
:
{
nf_instances
=
a
.
nf_instances
;
}
break
;
default:
{
// TODO:
}
}
// TODO:
}
virtual
~
audience_s
()
{
}
;
friend
void
to_json
(
nlohmann
::
json
&
j
,
const
audience_s
&
a
)
{
switch
(
a
.
type
)
{
case
0
:
{
j
[
"nf_type"
]
=
a
.
nf_type
;
}
break
;
case
1
:
{
j
[
"nf_instances"
]
=
nlohmann
::
json
::
array
();
for
(
auto
i
:
a
.
nf_instances
)
{
j
[
"nf_instances"
].
push_back
(
i
);
}
}
break
;
default:
{
}
}
}
friend
void
from_json
(
const
nlohmann
::
json
&
j
,
audience_s
&
a
)
{
if
(
j
.
find
(
"nf_type"
)
!=
j
.
end
())
{
j
.
at
(
"nf_type"
).
get_to
(
a
.
nf_type
);
a
.
type
=
0
;
}
if
(
j
.
find
(
"nf_instances"
)
!=
j
.
end
())
{
j
.
at
(
"nf_instances"
).
get_to
(
a
.
nf_instances
);
a
.
type
=
1
;
}
}
}
audience_t
;
class
AccessTokenClaims
{
public:
AccessTokenClaims
();
virtual
~
AccessTokenClaims
();
void
validate
();
/////////////////////////////////////////////
/// AccessTokenClaims members
/// <summary>
///
/// </summary>
std
::
string
getIss
()
const
;
void
setIss
(
std
::
string
const
&
value
);
/// <summary>
///
/// </summary>
std
::
string
getSub
()
const
;
void
setSub
(
std
::
string
const
&
value
);
/// <summary>
///
/// </summary>
audience_t
getAud
()
const
;
void
setAud
(
audience_t
const
&
value
);
/// <summary>
///
/// </summary>
std
::
string
getScope
()
const
;
void
setScope
(
std
::
string
const
&
value
);
/// <summary>
///
/// </summary>
int32_t
getExp
()
const
;
void
setExp
(
int32_t
const
value
);
/// <summary>
///
/// </summary>
PlmnId
getConsumerPlmnId
()
const
;
void
setConsumerPlmnId
(
PlmnId
const
&
value
);
bool
consumerPlmnIdIsSet
()
const
;
void
unsetConsumerPlmnId
();
/// <summary>
///
/// </summary>
PlmnId
getProducerPlmnId
()
const
;
void
setProducerPlmnId
(
PlmnId
const
&
value
);
bool
producerPlmnIdIsSet
()
const
;
void
unsetProducerPlmnId
();
friend
void
to_json
(
nlohmann
::
json
&
j
,
const
AccessTokenClaims
&
o
);
friend
void
from_json
(
const
nlohmann
::
json
&
j
,
AccessTokenClaims
&
o
);
protected:
std
::
string
m_Iss
;
std
::
string
m_Sub
;
audience_t
m_Aud
;
std
::
string
m_Scope
;
int32_t
m_Exp
;
PlmnId
m_ConsumerPlmnId
;
bool
m_ConsumerPlmnIdIsSet
;
PlmnId
m_ProducerPlmnId
;
bool
m_ProducerPlmnIdIsSet
;
};
}
}
}
#endif
/* AccessTokenClaims_H_ */
src/api-server/model/AccessTokenErr.cpp
0 → 100644
View file @
240bfc95
/**
* NRF OAuth2
* NRF OAuth2 Authorization. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.0.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "AccessTokenErr.h"
namespace
oai
{
namespace
nrf
{
namespace
model
{
AccessTokenErr
::
AccessTokenErr
()
{
m_Error
=
""
;
m_Error_description
=
""
;
m_Error_descriptionIsSet
=
false
;
m_Error_uri
=
""
;
m_Error_uriIsSet
=
false
;
}
AccessTokenErr
::~
AccessTokenErr
()
{
}
void
AccessTokenErr
::
validate
()
{
// TODO: implement validation
}
void
to_json
(
nlohmann
::
json
&
j
,
const
AccessTokenErr
&
o
)
{
j
=
nlohmann
::
json
();
j
[
"error"
]
=
o
.
m_Error
;
if
(
o
.
errorDescriptionIsSet
())
j
[
"error_description"
]
=
o
.
m_Error_description
;
if
(
o
.
errorUriIsSet
())
j
[
"error_uri"
]
=
o
.
m_Error_uri
;
}
void
from_json
(
const
nlohmann
::
json
&
j
,
AccessTokenErr
&
o
)
{
j
.
at
(
"error"
).
get_to
(
o
.
m_Error
);
if
(
j
.
find
(
"error_description"
)
!=
j
.
end
())
{
j
.
at
(
"error_description"
).
get_to
(
o
.
m_Error_description
);
o
.
m_Error_descriptionIsSet
=
true
;
}
if
(
j
.
find
(
"error_uri"
)
!=
j
.
end
())
{
j
.
at
(
"error_uri"
).
get_to
(
o
.
m_Error_uri
);
o
.
m_Error_uriIsSet
=
true
;
}
}
std
::
string
AccessTokenErr
::
getError
()
const
{
return
m_Error
;
}
void
AccessTokenErr
::
setError
(
std
::
string
const
&
value
)
{
m_Error
=
value
;
}
std
::
string
AccessTokenErr
::
getErrorDescription
()
const
{
return
m_Error_description
;
}
void
AccessTokenErr
::
setErrorDescription
(
std
::
string
const
&
value
)
{
m_Error_description
=
value
;
m_Error_descriptionIsSet
=
true
;
}
bool
AccessTokenErr
::
errorDescriptionIsSet
()
const
{
return
m_Error_descriptionIsSet
;
}
void
AccessTokenErr
::
unsetError_description
()
{
m_Error_descriptionIsSet
=
false
;
}
std
::
string
AccessTokenErr
::
getErrorUri
()
const
{
return
m_Error_uri
;
}
void
AccessTokenErr
::
setErrorUri
(
std
::
string
const
&
value
)
{
m_Error_uri
=
value
;
m_Error_uriIsSet
=
true
;
}
bool
AccessTokenErr
::
errorUriIsSet
()
const
{
return
m_Error_uriIsSet
;
}
void
AccessTokenErr
::
unsetError_uri
()
{
m_Error_uriIsSet
=
false
;
}
}
}
}
src/api-server/model/AccessTokenErr.h
0 → 100644
View file @
240bfc95
/**
* NRF OAuth2
* NRF OAuth2 Authorization. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.0.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* AccessTokenErr.h
*
*
*/
#ifndef AccessTokenErr_H_
#define AccessTokenErr_H_
#include <string>
#include <nlohmann/json.hpp>
namespace
oai
{
namespace
nrf
{
namespace
model
{
/// <summary>
///
/// </summary>
class
AccessTokenErr
{
public:
AccessTokenErr
();
virtual
~
AccessTokenErr
();
void
validate
();
/////////////////////////////////////////////
/// AccessTokenErr members
/// <summary>
///
/// </summary>
std
::
string
getError
()
const
;
void
setError
(
std
::
string
const
&
value
);
/// <summary>
///
/// </summary>
std
::
string
getErrorDescription
()
const
;
void
setErrorDescription
(
std
::
string
const
&
value
);
bool
errorDescriptionIsSet
()
const
;
void
unsetError_description
();
/// <summary>
///
/// </summary>
std
::
string
getErrorUri
()
const
;
void
setErrorUri
(
std
::
string
const
&
value
);
bool
errorUriIsSet
()
const
;
void
unsetError_uri
();
friend
void
to_json
(
nlohmann
::
json
&
j
,
const
AccessTokenErr
&
o
);
friend
void
from_json
(
const
nlohmann
::
json
&
j
,
AccessTokenErr
&
o
);
protected:
std
::
string
m_Error
;
std
::
string
m_Error_description
;
bool
m_Error_descriptionIsSet
;
std
::
string
m_Error_uri
;
bool
m_Error_uriIsSet
;
};
}
}
}
#endif
/* AccessTokenErr_H_ */
src/api-server/model/AccessTokenReq.cpp
0 → 100644
View file @
240bfc95
/**
* NRF OAuth2
* NRF OAuth2 Authorization. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.0.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "AccessTokenReq.h"
namespace
oai
{
namespace
nrf
{
namespace
model
{
AccessTokenReq
::
AccessTokenReq
()
{
m_Grant_type
=
""
;
m_NfInstanceId
=
""
;
m_NfTypeIsSet
=
false
;
m_TargetNfTypeIsSet
=
false
;
m_Scope
=
""
;
m_TargetNfInstanceId
=
""
;
m_TargetNfInstanceIdIsSet
=
false
;
m_RequesterPlmnIsSet
=
false
;
m_TargetPlmnIsSet
=
false
;
}
AccessTokenReq
::~
AccessTokenReq
()
{
}
void
AccessTokenReq
::
validate
()
{
// TODO: implement validation
}
void
to_json
(
nlohmann
::
json
&
j
,
const
AccessTokenReq
&
o
)
{
j
=
nlohmann
::
json
();
j
[
"grant_type"
]
=
o
.
m_Grant_type
;
j
[
"nfInstanceId"
]
=
o
.
m_NfInstanceId
;
if
(
o
.
nfTypeIsSet
())
j
[
"nfType"
]
=
o
.
m_NfType
;
if
(
o
.
targetNfTypeIsSet
())
j
[
"targetNfType"
]
=
o
.
m_TargetNfType
;
j
[
"scope"
]
=
o
.
m_Scope
;
if
(
o
.
targetNfInstanceIdIsSet
())
j
[
"targetNfInstanceId"
]
=
o
.
m_TargetNfInstanceId
;
if
(
o
.
requesterPlmnIsSet
())
j
[
"requesterPlmn"
]
=
o
.
m_RequesterPlmn
;
if
(
o
.
targetPlmnIsSet
())
j
[
"targetPlmn"
]
=
o
.
m_TargetPlmn
;
}
void
from_json
(
const
nlohmann
::
json
&
j
,
AccessTokenReq
&
o
)
{
j
.
at
(
"grant_type"
).
get_to
(
o
.
m_Grant_type
);
j
.
at
(
"nfInstanceId"
).
get_to
(
o
.
m_NfInstanceId
);
if
(
j
.
find
(
"nfType"
)
!=
j
.
end
())
{
j
.
at
(
"nfType"
).
get_to
(
o
.
m_NfType
);
o
.
m_NfTypeIsSet
=
true
;
}
if
(
j
.
find
(
"targetNfType"
)
!=
j
.
end
())
{
j
.
at
(
"targetNfType"
).
get_to
(
o
.
m_TargetNfType
);
o
.
m_TargetNfTypeIsSet
=
true
;
}
j
.
at
(
"scope"
).
get_to
(
o
.
m_Scope
);
if
(
j
.
find
(
"targetNfInstanceId"
)
!=
j
.
end
())
{
j
.
at
(
"targetNfInstanceId"
).
get_to
(
o
.
m_TargetNfInstanceId
);
o
.
m_TargetNfInstanceIdIsSet
=
true
;
}
if
(
j
.
find
(
"requesterPlmn"
)
!=
j
.
end
())
{
j
.
at
(
"requesterPlmn"
).
get_to
(
o
.
m_RequesterPlmn
);
o
.
m_RequesterPlmnIsSet
=
true
;
}
if
(
j
.
find
(
"targetPlmn"
)
!=
j
.
end
())
{
j
.
at
(
"targetPlmn"
).
get_to
(
o
.
m_TargetPlmn
);
o
.
m_TargetPlmnIsSet
=
true
;
}
}
std
::
string
AccessTokenReq
::
getGrantType
()
const
{
return
m_Grant_type
;
}
void
AccessTokenReq
::
setGrantType
(
std
::
string
const
&
value
)
{
m_Grant_type
=
value
;
}
std
::
string
AccessTokenReq
::
getNfInstanceId
()
const
{
return
m_NfInstanceId
;
}
void
AccessTokenReq
::
setNfInstanceId
(
std
::
string
const
&
value
)
{
m_NfInstanceId
=
value
;
}
NFType
AccessTokenReq
::
getNfType
()
const
{
return
m_NfType
;
}
void
AccessTokenReq
::
setNfType
(
NFType
const
&
value
)
{
m_NfType
=
value
;
m_NfTypeIsSet
=
true
;
}
bool
AccessTokenReq
::
nfTypeIsSet
()
const
{
return
m_NfTypeIsSet
;
}
void
AccessTokenReq
::
unsetNfType
()
{
m_NfTypeIsSet
=
false
;
}
NFType
AccessTokenReq
::
getTargetNfType
()
const
{
return
m_TargetNfType
;
}
void
AccessTokenReq
::
setTargetNfType
(
NFType
const
&
value
)
{
m_TargetNfType
=
value
;
m_TargetNfTypeIsSet
=
true
;
}
bool
AccessTokenReq
::
targetNfTypeIsSet
()
const
{
return
m_TargetNfTypeIsSet
;
}
void
AccessTokenReq
::
unsetTargetNfType
()
{
m_TargetNfTypeIsSet
=
false
;
}
std
::
string
AccessTokenReq
::
getScope
()
const
{
return
m_Scope
;
}
void
AccessTokenReq
::
setScope
(
std
::
string
const
&
value
)
{
m_Scope
=
value
;
}
std
::
string
AccessTokenReq
::
getTargetNfInstanceId
()
const
{
return
m_TargetNfInstanceId
;
}
void
AccessTokenReq
::
setTargetNfInstanceId
(
std
::
string
const
&
value
)
{
m_TargetNfInstanceId
=
value
;
m_TargetNfInstanceIdIsSet
=
true
;
}
bool
AccessTokenReq
::
targetNfInstanceIdIsSet
()
const
{
return
m_TargetNfInstanceIdIsSet
;
}
void
AccessTokenReq
::
unsetTargetNfInstanceId
()
{
m_TargetNfInstanceIdIsSet
=
false
;
}
PlmnId
AccessTokenReq
::
getRequesterPlmn
()
const
{
return
m_RequesterPlmn
;
}
void
AccessTokenReq
::
setRequesterPlmn
(
PlmnId
const
&
value
)
{
m_RequesterPlmn
=
value
;
m_RequesterPlmnIsSet
=
true
;
}
bool
AccessTokenReq
::
requesterPlmnIsSet
()
const
{
return
m_RequesterPlmnIsSet
;
}
void
AccessTokenReq
::
unsetRequesterPlmn
()
{
m_RequesterPlmnIsSet
=
false
;
}
PlmnId
AccessTokenReq
::
getTargetPlmn
()
const
{
return
m_TargetPlmn
;
}
void
AccessTokenReq
::
setTargetPlmn
(
PlmnId
const
&
value
)
{
m_TargetPlmn
=
value
;
m_TargetPlmnIsSet
=
true
;
}
bool
AccessTokenReq
::
targetPlmnIsSet
()
const
{
return
m_TargetPlmnIsSet
;
}
void
AccessTokenReq
::
unsetTargetPlmn
()
{
m_TargetPlmnIsSet
=
false
;
}
}
}
}
src/api-server/model/AccessTokenReq.h
0 → 100644
View file @
240bfc95
/**
* NRF OAuth2
* NRF OAuth2 Authorization. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.0.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* AccessTokenReq.h
*
*
*/
#ifndef AccessTokenReq_H_
#define AccessTokenReq_H_
#include "NFType.h"
#include <string>
#include "PlmnId.h"
#include <nlohmann/json.hpp>
namespace
oai
{
namespace
nrf
{
namespace
model
{
/// <summary>
///
/// </summary>
class
AccessTokenReq
{
public:
AccessTokenReq
();
virtual
~
AccessTokenReq
();
void
validate
();
/////////////////////////////////////////////
/// AccessTokenReq members
/// <summary>
///
/// </summary>
std
::
string
getGrantType
()
const
;
void
setGrantType
(
std
::
string
const
&
value
);
/// <summary>
///
/// </summary>
std
::
string
getNfInstanceId
()
const
;
void
setNfInstanceId
(
std
::
string
const
&
value
);
/// <summary>
///
/// </summary>
NFType
getNfType
()
const
;
void
setNfType
(
NFType
const
&
value
);
bool
nfTypeIsSet
()
const
;
void
unsetNfType
();
/// <summary>
///
/// </summary>
NFType
getTargetNfType
()
const
;
void
setTargetNfType
(
NFType
const
&
value
);
bool
targetNfTypeIsSet
()
const
;
void
unsetTargetNfType
();
/// <summary>
///
/// </summary>
std
::
string
getScope
()
const
;
void
setScope
(
std
::
string
const
&
value
);
/// <summary>
///
/// </summary>
std
::
string
getTargetNfInstanceId
()
const
;
void
setTargetNfInstanceId
(
std
::
string
const
&
value
);
bool
targetNfInstanceIdIsSet
()
const
;
void
unsetTargetNfInstanceId
();
/// <summary>
///
/// </summary>
PlmnId
getRequesterPlmn
()
const
;
void
setRequesterPlmn
(
PlmnId
const
&
value
);
bool
requesterPlmnIsSet
()
const
;
void
unsetRequesterPlmn
();
/// <summary>
///
/// </summary>
PlmnId
getTargetPlmn
()
const
;
void
setTargetPlmn
(
PlmnId
const
&
value
);
bool
targetPlmnIsSet
()
const
;
void
unsetTargetPlmn
();
friend
void
to_json
(
nlohmann
::
json
&
j
,
const
AccessTokenReq
&
o
);
friend
void
from_json
(
const
nlohmann
::
json
&
j
,
AccessTokenReq
&
o
);
protected:
std
::
string
m_Grant_type
;
std
::
string
m_NfInstanceId
;
NFType
m_NfType
;
bool
m_NfTypeIsSet
;
NFType
m_TargetNfType
;
bool
m_TargetNfTypeIsSet
;
std
::
string
m_Scope
;
std
::
string
m_TargetNfInstanceId
;
bool
m_TargetNfInstanceIdIsSet
;
PlmnId
m_RequesterPlmn
;
bool
m_RequesterPlmnIsSet
;
PlmnId
m_TargetPlmn
;
bool
m_TargetPlmnIsSet
;
};
}
}
}
#endif
/* AccessTokenReq_H_ */
src/api-server/model/AccessTokenRsp.cpp
0 → 100644
View file @
240bfc95
/**
* NRF OAuth2
* NRF OAuth2 Authorization. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.0.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "AccessTokenRsp.h"
namespace
oai
{
namespace
nrf
{
namespace
model
{
AccessTokenRsp
::
AccessTokenRsp
()
{
m_Access_token
=
""
;
m_Token_type
=
""
;
m_Expires_in
=
0
;
m_Expires_inIsSet
=
false
;
m_Scope
=
""
;
m_ScopeIsSet
=
false
;
}
AccessTokenRsp
::~
AccessTokenRsp
()
{
}
void
AccessTokenRsp
::
validate
()
{
// TODO: implement validation
}
void
to_json
(
nlohmann
::
json
&
j
,
const
AccessTokenRsp
&
o
)
{
j
=
nlohmann
::
json
();
j
[
"access_token"
]
=
o
.
m_Access_token
;
j
[
"token_type"
]
=
o
.
m_Token_type
;
if
(
o
.
expiresInIsSet
())
j
[
"expires_in"
]
=
o
.
m_Expires_in
;
if
(
o
.
scopeIsSet
())
j
[
"scope"
]
=
o
.
m_Scope
;
}
void
from_json
(
const
nlohmann
::
json
&
j
,
AccessTokenRsp
&
o
)
{
j
.
at
(
"access_token"
).
get_to
(
o
.
m_Access_token
);
j
.
at
(
"token_type"
).
get_to
(
o
.
m_Token_type
);
if
(
j
.
find
(
"expires_in"
)
!=
j
.
end
())
{
j
.
at
(
"expires_in"
).
get_to
(
o
.
m_Expires_in
);
o
.
m_Expires_inIsSet
=
true
;
}
if
(
j
.
find
(
"scope"
)
!=
j
.
end
())
{
j
.
at
(
"scope"
).
get_to
(
o
.
m_Scope
);
o
.
m_ScopeIsSet
=
true
;
}
}
std
::
string
AccessTokenRsp
::
getAccessToken
()
const
{
return
m_Access_token
;
}
void
AccessTokenRsp
::
setAccessToken
(
std
::
string
const
&
value
)
{
m_Access_token
=
value
;
}
std
::
string
AccessTokenRsp
::
getTokenType
()
const
{
return
m_Token_type
;
}
void
AccessTokenRsp
::
setTokenType
(
std
::
string
const
&
value
)
{
m_Token_type
=
value
;
}
int32_t
AccessTokenRsp
::
getExpiresIn
()
const
{
return
m_Expires_in
;
}
void
AccessTokenRsp
::
setExpiresIn
(
int32_t
const
value
)
{
m_Expires_in
=
value
;
m_Expires_inIsSet
=
true
;
}
bool
AccessTokenRsp
::
expiresInIsSet
()
const
{
return
m_Expires_inIsSet
;
}
void
AccessTokenRsp
::
unsetExpires_in
()
{
m_Expires_inIsSet
=
false
;
}
std
::
string
AccessTokenRsp
::
getScope
()
const
{
return
m_Scope
;
}
void
AccessTokenRsp
::
setScope
(
std
::
string
const
&
value
)
{
m_Scope
=
value
;
m_ScopeIsSet
=
true
;
}
bool
AccessTokenRsp
::
scopeIsSet
()
const
{
return
m_ScopeIsSet
;
}
void
AccessTokenRsp
::
unsetScope
()
{
m_ScopeIsSet
=
false
;
}
}
}
}
src/api-server/model/AccessTokenRsp.h
0 → 100644
View file @
240bfc95
/**
* NRF OAuth2
* NRF OAuth2 Authorization. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.0.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* AccessTokenRsp.h
*
*
*/
#ifndef AccessTokenRsp_H_
#define AccessTokenRsp_H_
#include <string>
#include <nlohmann/json.hpp>
namespace
oai
{
namespace
nrf
{
namespace
model
{
/// <summary>
///
/// </summary>
class
AccessTokenRsp
{
public:
AccessTokenRsp
();
virtual
~
AccessTokenRsp
();
void
validate
();
/////////////////////////////////////////////
/// AccessTokenRsp members
/// <summary>
/// JWS Compact Serialized representation of JWS signed JSON object (AccessTokenClaims)
/// </summary>
std
::
string
getAccessToken
()
const
;
void
setAccessToken
(
std
::
string
const
&
value
);
/// <summary>
///
/// </summary>
std
::
string
getTokenType
()
const
;
void
setTokenType
(
std
::
string
const
&
value
);
/// <summary>
///
/// </summary>
int32_t
getExpiresIn
()
const
;
void
setExpiresIn
(
int32_t
const
value
);
bool
expiresInIsSet
()
const
;
void
unsetExpires_in
();
/// <summary>
///
/// </summary>
std
::
string
getScope
()
const
;
void
setScope
(
std
::
string
const
&
value
);
bool
scopeIsSet
()
const
;
void
unsetScope
();
friend
void
to_json
(
nlohmann
::
json
&
j
,
const
AccessTokenRsp
&
o
);
friend
void
from_json
(
const
nlohmann
::
json
&
j
,
AccessTokenRsp
&
o
);
protected:
std
::
string
m_Access_token
;
std
::
string
m_Token_type
;
int32_t
m_Expires_in
;
bool
m_Expires_inIsSet
;
std
::
string
m_Scope
;
bool
m_ScopeIsSet
;
};
}
}
}
#endif
/* AccessTokenRsp_H_ */
src/api-server/nrf-api-server.cpp
View file @
240bfc95
...
...
@@ -88,6 +88,7 @@ void NRFApiServer::init(size_t thr) {
m_subscriptionIDDocumentApiImpl
->
init
();
m_subscriptionsCollectionApiImpl
->
init
();
m_discNFInstancesStoreApiImpl
->
init
();
m_accessTokenRequestApiImpl
->
init
();
}
void
NRFApiServer
::
start
()
{
Logger
::
nrf_sbi
().
info
(
"HTTP1 server started"
);
...
...
src/api-server/nrf-api-server.h
View file @
240bfc95
...
...
@@ -50,6 +50,7 @@
#include "SubscriptionIDDocumentApiImpl.h"
#include "SubscriptionsCollectionApiImpl.h"
#include "DiscNFInstancesStoreApiImpl.h"
#include "AccessTokenRequestApiImpl.h"
#include "nrf_app.hpp"
using
namespace
oai
::
nrf
::
api
;
...
...
@@ -77,7 +78,8 @@ class NRFApiServer {
<
SubscriptionsCollectionApiImpl
>
(
m_router
,
nrf_app_inst
,
m_address
);
m_discNFInstancesStoreApiImpl
=
std
::
make_shared
<
DiscNFInstancesStoreApiImpl
>
(
m_router
,
nrf_app_inst
,
m_address
);
m_accessTokenRequestApiImpl
=
std
::
make_shared
<
AccessTokenRequestApiImpl
>
(
m_router
,
nrf_app_inst
,
m_address
);
}
void
init
(
size_t
thr
=
1
);
void
start
();
...
...
@@ -93,6 +95,7 @@ class NRFApiServer {
std
::
shared_ptr
<
SubscriptionIDDocumentApiImpl
>
m_subscriptionIDDocumentApiImpl
;
std
::
shared_ptr
<
SubscriptionsCollectionApiImpl
>
m_subscriptionsCollectionApiImpl
;
std
::
shared_ptr
<
DiscNFInstancesStoreApiImpl
>
m_discNFInstancesStoreApiImpl
;
std
::
shared_ptr
<
AccessTokenRequestApiImpl
>
m_accessTokenRequestApiImpl
;
std
::
string
m_address
;
};
...
...
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