mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 10:45:47 +08:00
Rename redirectUrl to redirectUri.
This commit is contained in:
parent
df948e9e34
commit
4e22e0523d
@ -31,7 +31,7 @@ func (c *ApiController) AuthLogin() {
|
|||||||
code := c.Input().Get("code")
|
code := c.Input().Get("code")
|
||||||
state := c.Input().Get("state")
|
state := c.Input().Get("state")
|
||||||
method := c.Input().Get("method")
|
method := c.Input().Get("method")
|
||||||
redirectUrl := c.Input().Get("redirect_url")
|
redirectUri := c.Input().Get("redirect_uri")
|
||||||
|
|
||||||
application := object.GetApplication(fmt.Sprintf("admin/%s", applicationName))
|
application := object.GetApplication(fmt.Sprintf("admin/%s", applicationName))
|
||||||
provider := object.GetProvider(fmt.Sprintf("admin/%s", providerName))
|
provider := object.GetProvider(fmt.Sprintf("admin/%s", providerName))
|
||||||
@ -40,7 +40,7 @@ func (c *ApiController) AuthLogin() {
|
|||||||
oauthConfig := idProvider.GetConfig()
|
oauthConfig := idProvider.GetConfig()
|
||||||
oauthConfig.ClientID = provider.ClientId
|
oauthConfig.ClientID = provider.ClientId
|
||||||
oauthConfig.ClientSecret = provider.ClientSecret
|
oauthConfig.ClientSecret = provider.ClientSecret
|
||||||
oauthConfig.RedirectURL = redirectUrl
|
oauthConfig.RedirectURL = redirectUri
|
||||||
|
|
||||||
var resp Response
|
var resp Response
|
||||||
var res authResponse
|
var res authResponse
|
||||||
|
@ -35,7 +35,7 @@ type Application struct {
|
|||||||
|
|
||||||
ClientId string `xorm:"varchar(100)" json:"clientId"`
|
ClientId string `xorm:"varchar(100)" json:"clientId"`
|
||||||
ClientSecret string `xorm:"varchar(100)" json:"clientSecret"`
|
ClientSecret string `xorm:"varchar(100)" json:"clientSecret"`
|
||||||
RedirectUrls []string `xorm:"varchar(1000)" json:"redirectUrls"`
|
RedirectUris []string `xorm:"varchar(1000)" json:"redirectUris"`
|
||||||
ExpireInHours int `json:"expireInHours"`
|
ExpireInHours int `json:"expireInHours"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,8 +155,8 @@ func GetOAuthCode(userId string, clientId string, responseType string, redirectU
|
|||||||
}
|
}
|
||||||
|
|
||||||
validUri := false
|
validUri := false
|
||||||
for _, url := range application.RedirectUrls {
|
for _, tmpUri := range application.RedirectUris {
|
||||||
if strings.Contains(redirectUri, url) {
|
if strings.Contains(redirectUri, tmpUri) {
|
||||||
validUri = true
|
validUri = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -201,8 +201,8 @@ class ApplicationEditPage extends React.Component {
|
|||||||
<Col span={22} >
|
<Col span={22} >
|
||||||
<UrlTable
|
<UrlTable
|
||||||
title="Redirect URLs"
|
title="Redirect URLs"
|
||||||
table={this.state.application.redirectUrls}
|
table={this.state.application.redirectUris}
|
||||||
onUpdateTable={(value) => { this.updateApplicationField('redirectUrls', value)}}
|
onUpdateTable={(value) => { this.updateApplicationField('redirectUris', value)}}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -51,7 +51,7 @@ class ApplicationListPage extends React.Component {
|
|||||||
logo: "https://cdn.casbin.com/logo/logo_384x96.png",
|
logo: "https://cdn.casbin.com/logo/logo_384x96.png",
|
||||||
EnablePassword: true,
|
EnablePassword: true,
|
||||||
providers: [],
|
providers: [],
|
||||||
redirectUrls: [],
|
redirectUris: [],
|
||||||
expireInHours: 24 * 7,
|
expireInHours: 24 * 7,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,8 @@ export function logout() {
|
|||||||
}).then(res => res.json());
|
}).then(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
export function authLogin(applicationName, providerName, code, state, redirectUrl, method) {
|
export function authLogin(applicationName, providerName, code, state, redirectUri, method) {
|
||||||
return fetch(`${authConfig.serverUrl}/api/auth/login?application=${applicationName}&provider=${providerName}&code=${code}&state=${state}&redirect_url=${redirectUrl}&method=${method}`, {
|
return fetch(`${authConfig.serverUrl}/api/auth/login?application=${applicationName}&provider=${providerName}&code=${code}&state=${state}&redirect_url=${redirectUri}&method=${method}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
}).then(res => res.json());
|
}).then(res => res.json());
|
||||||
|
@ -47,9 +47,9 @@ class AuthCallback extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
authLogin() {
|
authLogin() {
|
||||||
let redirectUrl;
|
let redirectUri;
|
||||||
redirectUrl = `${window.location.origin}/callback/${this.state.applicationName}/${this.state.providerName}/${this.state.method}`;
|
redirectUri = `${window.location.origin}/callback/${this.state.applicationName}/${this.state.providerName}/${this.state.method}`;
|
||||||
AuthBackend.authLogin(this.state.applicationName, this.state.providerName, this.state.code, this.state.state, redirectUrl, this.state.method)
|
AuthBackend.authLogin(this.state.applicationName, this.state.providerName, this.state.code, this.state.state, redirectUri, this.state.method)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.status === "ok") {
|
if (res.status === "ok") {
|
||||||
window.location.href = '/';
|
window.location.href = '/';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user