Skip to content
Snippets Groups Projects
Verified Commit 7dc55226 authored by Gabriel Zachmann's avatar Gabriel Zachmann
Browse files

fix code issues

parent 1cc7adc6
No related branches found
No related tags found
No related merge requests found
Pipeline #323217 passed
package pkg
import (
"github.com/oidc-mytoken/api/v0"
"github.com/oidc-mytoken/server/internal/model/profiled"
"github.com/oidc-mytoken/server/internal/mytoken/universalmytoken"
)
// MytokenFromMytokenRequest is a request to create a new Mytoken from an existing Mytoken
// It is analog to api.MytokenFromMytokenRequest
type MytokenFromMytokenRequest struct {
api.MytokenFromMytokenRequest `json:",inline"`
profiled.GeneralMytokenRequest `json:",inline"`
Mytoken universalmytoken.UniversalMytoken `json:"mytoken"`
FailOnRestrictionsNotTighter bool `json:"error_on_restrictions,omitempty"`
}
// NewMytokenRequest creates a MytokenFromMytokenRequest with the default values where they can be omitted
......
......@@ -51,63 +51,6 @@ func NewOIDCFlowRequest() *OIDCFlowRequest {
}
}
/*
// SetRedirectType sets the (hidden) redirect type
func (r *OIDCFlowRequest) SetRedirectType(redirect string) {
r.clientType = redirect
}
// SetRedirectURI sets the (hidden) redirect uri
func (r *OIDCFlowRequest) SetRedirectURI(uri string) {
r.redirectURI = uri
}
// MarshalJSON implements the json.Marshaler interface
func (r OIDCFlowRequest) MarshalJSON() ([]byte, error) { // skipcq: CRT-P0003
type ofr OIDCFlowRequest
o := struct {
ofr
ClientType string `json:"client_type,omitempty"`
RedirectURI string `json:"redirect_uri,omitempty"`
}{
ofr: ofr(r),
ClientType: r.clientType,
RedirectURI: r.redirectURI,
}
data, err := json.Marshal(o)
return data, errors.WithStack(err)
}
// UnmarshalJSON implements the json.Unmarshaler interface
func (r *OIDCFlowRequest) UnmarshalJSON(data []byte) error {
type ofr OIDCFlowRequest
o := struct {
ofr
RedirectType string `json:"client_type"`
RedirectURI string `json:"redirect_uri"`
}{
ofr: ofr(*NewOIDCFlowRequest()),
}
o.RedirectType = o.clientType
o.RedirectURI = o.redirectURI
if err := json.Unmarshal(data, &o); err != nil {
return errors.WithStack(err)
}
o.clientType = o.RedirectType
o.redirectURI = o.RedirectURI
*r = OIDCFlowRequest(o.ofr)
return nil
}
// ToAuthCodeFlowRequest creates a AuthCodeFlowRequest from the OIDCFlowRequest
func (r OIDCFlowRequest) ToAuthCodeFlowRequest() AuthCodeFlowRequest { // skipcq: CRT-P0003
return AuthCodeFlowRequest{
OIDCFlowRequest: r,
ClientType: r.clientType,
RedirectURI: r.redirectURI,
}
}
*/
// Scan implements the sql.Scanner interface
func (r *OIDCFlowRequest) Scan(src interface{}) error {
v, ok := src.([]byte)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment