Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use authctxId to authentication #142

Merged
merged 4 commits into from
Sep 13, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions internal/sbi/consumer/ausf_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net/url"
"strconv"
"strings"
"sync"

"github.com/antihax/optional"
Expand Down Expand Up @@ -99,7 +100,8 @@ func (s *nausfService) SendAuth5gAkaConfirmRequest(ue *amf_context.AmfUe, resSta
*models.ConfirmationDataResponse, *models.ProblemDetails, error,
) {
var ausfUri string
if confirmUri, err := url.Parse(ue.AuthenticationCtx.Links["5g-aka"].Href); err != nil {
confirmUri, err := url.Parse(ue.AuthenticationCtx.Links["5g-aka"].Href)
if err != nil {
return nil, nil, err
} else {
ausfUri = fmt.Sprintf("%s://%s", confirmUri.Scheme, confirmUri.Host)
Expand All @@ -119,9 +121,16 @@ func (s *nausfService) SendAuth5gAkaConfirmRequest(ue *amf_context.AmfUe, resSta
if err != nil {
return nil, nil, err
}
splituri := strings.Split(confirmUri.RequestURI(), "/")
authctxId := ""
if len(splituri) > 4 {
authctxId = splituri[4]
} else {
return nil, nil, fmt.Errorf("authctxId is nil")
}

confirmResult, httpResponse, err := client.DefaultApi.UeAuthenticationsAuthCtxId5gAkaConfirmationPut(
ctx, ue.Suci, confirmData)
ctx, authctxId, confirmData)
defer func() {
if httpResponse != nil {
if rspCloseErr := httpResponse.Body.Close(); rspCloseErr != nil {
Expand Down Expand Up @@ -171,7 +180,15 @@ func (s *nausfService) SendEapAuthConfirmRequest(ue *amf_context.AmfUe, eapMsg n
return nil, nil, err
}

eapSession, httpResponse, err := client.DefaultApi.EapAuthMethod(ctx, ue.Suci, eapSessionReq)
splituri := strings.Split(confirmUri.RequestURI(), "/")
authctxId := ""
if len(splituri) > 4 {
donald1218 marked this conversation as resolved.
Show resolved Hide resolved
authctxId = splituri[4]
} else {
return nil, nil, fmt.Errorf("authctxId is nil")
}

eapSession, httpResponse, err := client.DefaultApi.EapAuthMethod(ctx, authctxId, eapSessionReq)
defer func() {
if httpResponse != nil {
if rspCloseErr := httpResponse.Body.Close(); rspCloseErr != nil {
Expand Down
Loading