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