mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 04:10:20 +08:00
Fix bug that cannot access application's public certificate for non "admin" owner
This commit is contained in:
@ -90,15 +90,25 @@ func (c *ApiController) GetApplication() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Input().Get("withKey") != "" && application.Cert != "" {
|
if c.Input().Get("withKey") != "" && application != nil && application.Cert != "" {
|
||||||
cert, err := object.GetCert(util.GetId(application.Owner, application.Cert))
|
cert, err := object.GetCert(util.GetId(application.Owner, application.Cert))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.ResponseError(err.Error())
|
c.ResponseError(err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cert == nil {
|
||||||
|
cert, err = object.GetCert(util.GetId(application.Organization, application.Cert))
|
||||||
|
if err != nil {
|
||||||
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if cert != nil {
|
||||||
application.CertPublicKey = cert.Certificate
|
application.CertPublicKey = cert.Certificate
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
c.ResponseOk(object.GetMaskedApplication(application, userId))
|
c.ResponseOk(object.GetMaskedApplication(application, userId))
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user