mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-15 17:13:49 +08:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
cf4e76f9dc | |||
81f2d01dc1 | |||
61773d3173 | |||
ec29621547 | |||
b8e324cadf | |||
f37fd6ba87 | |||
b4bf734fe8 | |||
f0431701c9 | |||
aa5078de15 | |||
9a324b2cca | |||
919eaf1df4 | |||
cd902a21ba | |||
fe0ab0aa6f | |||
a0e11cc8a0 | |||
8a66448365 |
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@ -114,6 +114,7 @@ jobs:
|
|||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
if: github.repository == 'casdoor/casdoor' && github.event_name == 'push' && steps.should_push.outputs.push=='true'
|
if: github.repository == 'casdoor/casdoor' && github.event_name == 'push' && steps.should_push.outputs.push=='true'
|
||||||
with:
|
with:
|
||||||
|
target: STANDARD
|
||||||
push: true
|
push: true
|
||||||
tags: casbin/casdoor:${{steps.get-current-tag.outputs.tag }},casbin/casdoor:latest
|
tags: casbin/casdoor:${{steps.get-current-tag.outputs.tag }},casbin/casdoor:latest
|
||||||
|
|
||||||
|
61
Dockerfile
61
Dockerfile
@ -1,8 +1,3 @@
|
|||||||
FROM golang:1.17.5 AS BACK
|
|
||||||
WORKDIR /go/src/casdoor
|
|
||||||
COPY . .
|
|
||||||
RUN ./build.sh && apt update && apt install wait-for-it && chmod +x /usr/bin/wait-for-it
|
|
||||||
|
|
||||||
FROM node:16.13.0 AS FRONT
|
FROM node:16.13.0 AS FRONT
|
||||||
WORKDIR /web
|
WORKDIR /web
|
||||||
COPY ./web .
|
COPY ./web .
|
||||||
@ -10,28 +5,42 @@ RUN yarn config set registry https://registry.npmmirror.com
|
|||||||
RUN yarn install && yarn run build
|
RUN yarn install && yarn run build
|
||||||
|
|
||||||
|
|
||||||
FROM debian:latest AS ALLINONE
|
FROM golang:1.17.5 AS BACK
|
||||||
RUN apt update
|
WORKDIR /go/src/casdoor
|
||||||
RUN apt install -y ca-certificates && update-ca-certificates
|
COPY . .
|
||||||
RUN apt install -y mariadb-server mariadb-client && mkdir -p web/build && chmod 777 /tmp
|
RUN ./build.sh
|
||||||
LABEL MAINTAINER="https://casdoor.org/"
|
|
||||||
COPY --from=BACK /go/src/casdoor/ ./
|
|
||||||
COPY --from=BACK /usr/bin/wait-for-it ./
|
|
||||||
COPY --from=FRONT /web/build /web/build
|
|
||||||
CMD chmod 777 /tmp && service mariadb start&&\
|
|
||||||
if [ "${MYSQL_ROOT_PASSWORD}" = "" ] ;then MYSQL_ROOT_PASSWORD=123456 ; fi&&\
|
|
||||||
mysqladmin -u root password ${MYSQL_ROOT_PASSWORD} &&\
|
|
||||||
./wait-for-it localhost:3306 -- ./server --createDatabase=true
|
|
||||||
|
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest AS STANDARD
|
||||||
RUN sed -i 's/https/http/' /etc/apk/repositories
|
|
||||||
RUN apk add curl
|
|
||||||
RUN apk add ca-certificates && update-ca-certificates
|
|
||||||
LABEL MAINTAINER="https://casdoor.org/"
|
LABEL MAINTAINER="https://casdoor.org/"
|
||||||
|
|
||||||
COPY --from=BACK /go/src/casdoor/ ./
|
WORKDIR /
|
||||||
COPY --from=BACK /usr/bin/wait-for-it ./
|
COPY --from=BACK /go/src/casdoor/server ./server
|
||||||
RUN mkdir -p web/build && apk add --no-cache bash coreutils
|
COPY --from=BACK /go/src/casdoor/swagger ./swagger
|
||||||
COPY --from=FRONT /web/build /web/build
|
COPY --from=BACK /go/src/casdoor/conf/app.conf ./conf/app.conf
|
||||||
CMD ./server
|
COPY --from=FRONT /web/build ./web/build
|
||||||
|
ENTRYPOINT ["/server"]
|
||||||
|
|
||||||
|
|
||||||
|
FROM debian:latest AS db
|
||||||
|
RUN apt update \
|
||||||
|
&& apt install -y \
|
||||||
|
mariadb-server \
|
||||||
|
mariadb-client \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
|
||||||
|
FROM db AS ALLINONE
|
||||||
|
LABEL MAINTAINER="https://casdoor.org/"
|
||||||
|
|
||||||
|
ENV MYSQL_ROOT_PASSWORD=123456
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
COPY --from=BACK /go/src/casdoor/server ./server
|
||||||
|
COPY --from=BACK /go/src/casdoor/swagger ./swagger
|
||||||
|
COPY --from=BACK /go/src/casdoor/docker-entrypoint.sh /docker-entrypoint.sh
|
||||||
|
COPY --from=BACK /go/src/casdoor/conf/app.conf ./conf/app.conf
|
||||||
|
COPY --from=FRONT /web/build ./web/build
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash"]
|
||||||
|
CMD ["/docker-entrypoint.sh"]
|
||||||
|
@ -98,7 +98,7 @@ For casdoor, if you have any questions, you can give Issues, or you can also dir
|
|||||||
|
|
||||||
### I18n translation
|
### I18n translation
|
||||||
|
|
||||||
If you are contributing to casdoor, please note that we use [Crowdin](https://crowdin.com/project/casdoor-web) as translating platform and i18next as translating tool. When you add some words using i18next in the ```web/``` directory, please remember to add what you have added to the ```web/src/locales/en/data.json``` file.
|
If you are contributing to casdoor, please note that we use [Crowdin](https://crowdin.com/project/casdoor-site) as translating platform and i18next as translating tool. When you add some words using i18next in the ```web/``` directory, please remember to add what you have added to the ```web/src/locales/en/data.json``` file.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
105
captcha/aliyun.go
Normal file
105
captcha/aliyun.go
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
// Copyright 2022 The Casdoor Authors. All Rights Reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package captcha
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"sort"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/casdoor/casdoor/util"
|
||||||
|
)
|
||||||
|
|
||||||
|
const AliyunCaptchaVerifyUrl = "http://afs.aliyuncs.com"
|
||||||
|
|
||||||
|
type AliyunCaptchaProvider struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAliyunCaptchaProvider() *AliyunCaptchaProvider {
|
||||||
|
captcha := &AliyunCaptchaProvider{}
|
||||||
|
return captcha
|
||||||
|
}
|
||||||
|
|
||||||
|
func contentEscape(str string) string {
|
||||||
|
str = strings.Replace(str, " ", "%20", -1)
|
||||||
|
str = url.QueryEscape(str)
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
|
||||||
|
func (captcha *AliyunCaptchaProvider) VerifyCaptcha(token, clientSecret string) (bool, error) {
|
||||||
|
pathData, err := url.ParseQuery(token)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
pathData["Action"] = []string{"AuthenticateSig"}
|
||||||
|
pathData["Format"] = []string{"json"}
|
||||||
|
pathData["SignatureMethod"] = []string{"HMAC-SHA1"}
|
||||||
|
pathData["SignatureNonce"] = []string{strconv.FormatInt(time.Now().UnixNano(), 10)}
|
||||||
|
pathData["SignatureVersion"] = []string{"1.0"}
|
||||||
|
pathData["Timestamp"] = []string{time.Now().UTC().Format("2006-01-02T15:04:05Z")}
|
||||||
|
pathData["Version"] = []string{"2018-01-12"}
|
||||||
|
|
||||||
|
var keys []string
|
||||||
|
for k := range pathData {
|
||||||
|
keys = append(keys, k)
|
||||||
|
}
|
||||||
|
sort.Strings(keys)
|
||||||
|
|
||||||
|
sortQuery := ""
|
||||||
|
for _, k := range keys {
|
||||||
|
sortQuery += k + "=" + contentEscape(pathData[k][0]) + "&"
|
||||||
|
}
|
||||||
|
sortQuery = strings.TrimSuffix(sortQuery, "&")
|
||||||
|
|
||||||
|
stringToSign := fmt.Sprintf("GET&%s&%s", url.QueryEscape("/"), url.QueryEscape(sortQuery))
|
||||||
|
|
||||||
|
signature := util.GetHmacSha1(clientSecret+"&", stringToSign)
|
||||||
|
|
||||||
|
resp, err := http.Get(fmt.Sprintf("%s?%s&Signature=%s", AliyunCaptchaVerifyUrl, sortQuery, url.QueryEscape(signature)))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
defer resp.Body.Close()
|
||||||
|
body, err := ioutil.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
type captchaResponse struct {
|
||||||
|
Code int `json:"Code"`
|
||||||
|
Msg string `json:"Msg"`
|
||||||
|
}
|
||||||
|
captchaResp := &captchaResponse{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(body, captchaResp)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if captchaResp.Code != 100 {
|
||||||
|
return false, errors.New(captchaResp.Msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, nil
|
||||||
|
}
|
@ -25,6 +25,8 @@ func GetCaptchaProvider(captchaType string) CaptchaProvider {
|
|||||||
return NewReCaptchaProvider()
|
return NewReCaptchaProvider()
|
||||||
} else if captchaType == "hCaptcha" {
|
} else if captchaType == "hCaptcha" {
|
||||||
return NewHCaptchaProvider()
|
return NewHCaptchaProvider()
|
||||||
|
} else if captchaType == "Aliyun Captcha" {
|
||||||
|
return NewAliyunCaptchaProvider()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -76,13 +76,16 @@ type Response struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Captcha struct {
|
type Captcha struct {
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
AppKey string `json:"appKey"`
|
AppKey string `json:"appKey"`
|
||||||
Scene string `json:"scene"`
|
Scene string `json:"scene"`
|
||||||
CaptchaId string `json:"captchaId"`
|
CaptchaId string `json:"captchaId"`
|
||||||
CaptchaImage []byte `json:"captchaImage"`
|
CaptchaImage []byte `json:"captchaImage"`
|
||||||
ClientId string `json:"clientId"`
|
ClientId string `json:"clientId"`
|
||||||
ClientSecret string `json:"clientSecret"`
|
ClientSecret string `json:"clientSecret"`
|
||||||
|
ClientId2 string `json:"clientId2"`
|
||||||
|
ClientSecret2 string `json:"clientSecret2"`
|
||||||
|
SubType string `json:"subType"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signup
|
// Signup
|
||||||
@ -313,7 +316,14 @@ func (c *ApiController) GetCaptcha() {
|
|||||||
c.ResponseOk(Captcha{Type: captchaProvider.Type, CaptchaId: id, CaptchaImage: img})
|
c.ResponseOk(Captcha{Type: captchaProvider.Type, CaptchaId: id, CaptchaImage: img})
|
||||||
return
|
return
|
||||||
} else if captchaProvider.Type != "" {
|
} else if captchaProvider.Type != "" {
|
||||||
c.ResponseOk(Captcha{Type: captchaProvider.Type, ClientId: captchaProvider.ClientId, ClientSecret: captchaProvider.ClientSecret})
|
c.ResponseOk(Captcha{
|
||||||
|
Type: captchaProvider.Type,
|
||||||
|
SubType: captchaProvider.SubType,
|
||||||
|
ClientId: captchaProvider.ClientId,
|
||||||
|
ClientSecret: captchaProvider.ClientSecret,
|
||||||
|
ClientId2: captchaProvider.ClientId2,
|
||||||
|
ClientSecret2: captchaProvider.ClientSecret2,
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,6 +165,8 @@ func (c *ApiController) GetOAuthCode() {
|
|||||||
// @Param client_secret query string true "OAuth client secret"
|
// @Param client_secret query string true "OAuth client secret"
|
||||||
// @Param code query string true "OAuth code"
|
// @Param code query string true "OAuth code"
|
||||||
// @Success 200 {object} object.TokenWrapper The Response object
|
// @Success 200 {object} object.TokenWrapper The Response object
|
||||||
|
// @Success 400 {object} object.TokenError The Response object
|
||||||
|
// @Success 401 {object} object.TokenError The Response object
|
||||||
// @router /login/oauth/access_token [post]
|
// @router /login/oauth/access_token [post]
|
||||||
func (c *ApiController) GetOAuthToken() {
|
func (c *ApiController) GetOAuthToken() {
|
||||||
grantType := c.Input().Get("grant_type")
|
grantType := c.Input().Get("grant_type")
|
||||||
@ -200,6 +202,7 @@ func (c *ApiController) GetOAuthToken() {
|
|||||||
host := c.Ctx.Request.Host
|
host := c.Ctx.Request.Host
|
||||||
|
|
||||||
c.Data["json"] = object.GetOAuthToken(grantType, clientId, clientSecret, code, verifier, scope, username, password, host, tag, avatar)
|
c.Data["json"] = object.GetOAuthToken(grantType, clientId, clientSecret, code, verifier, scope, username, password, host, tag, avatar)
|
||||||
|
c.SetTokenErrorHttpStatus()
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,6 +216,8 @@ func (c *ApiController) GetOAuthToken() {
|
|||||||
// @Param client_id query string true "OAuth client id"
|
// @Param client_id query string true "OAuth client id"
|
||||||
// @Param client_secret query string false "OAuth client secret"
|
// @Param client_secret query string false "OAuth client secret"
|
||||||
// @Success 200 {object} object.TokenWrapper The Response object
|
// @Success 200 {object} object.TokenWrapper The Response object
|
||||||
|
// @Success 400 {object} object.TokenError The Response object
|
||||||
|
// @Success 401 {object} object.TokenError The Response object
|
||||||
// @router /login/oauth/refresh_token [post]
|
// @router /login/oauth/refresh_token [post]
|
||||||
func (c *ApiController) RefreshToken() {
|
func (c *ApiController) RefreshToken() {
|
||||||
grantType := c.Input().Get("grant_type")
|
grantType := c.Input().Get("grant_type")
|
||||||
@ -235,6 +240,7 @@ func (c *ApiController) RefreshToken() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = object.RefreshToken(grantType, refreshToken, scope, clientId, clientSecret, host)
|
c.Data["json"] = object.RefreshToken(grantType, refreshToken, scope, clientId, clientSecret, host)
|
||||||
|
c.SetTokenErrorHttpStatus()
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,6 +276,8 @@ func (c *ApiController) TokenLogout() {
|
|||||||
// @Param token formData string true "access_token's value or refresh_token's value"
|
// @Param token formData string true "access_token's value or refresh_token's value"
|
||||||
// @Param token_type_hint formData string true "the token type access_token or refresh_token"
|
// @Param token_type_hint formData string true "the token type access_token or refresh_token"
|
||||||
// @Success 200 {object} object.IntrospectionResponse The Response object
|
// @Success 200 {object} object.IntrospectionResponse The Response object
|
||||||
|
// @Success 400 {object} object.TokenError The Response object
|
||||||
|
// @Success 401 {object} object.TokenError The Response object
|
||||||
// @router /login/oauth/introspect [post]
|
// @router /login/oauth/introspect [post]
|
||||||
func (c *ApiController) IntrospectToken() {
|
func (c *ApiController) IntrospectToken() {
|
||||||
tokenValue := c.Input().Get("token")
|
tokenValue := c.Input().Get("token")
|
||||||
@ -279,12 +287,21 @@ func (c *ApiController) IntrospectToken() {
|
|||||||
clientSecret = c.Input().Get("client_secret")
|
clientSecret = c.Input().Get("client_secret")
|
||||||
if clientId == "" || clientSecret == "" {
|
if clientId == "" || clientSecret == "" {
|
||||||
c.ResponseError("empty clientId or clientSecret")
|
c.ResponseError("empty clientId or clientSecret")
|
||||||
|
c.Data["json"] = &object.TokenError{
|
||||||
|
Error: object.INVALID_REQUEST,
|
||||||
|
}
|
||||||
|
c.SetTokenErrorHttpStatus()
|
||||||
|
c.ServeJSON()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
application := object.GetApplicationByClientId(clientId)
|
application := object.GetApplicationByClientId(clientId)
|
||||||
if application == nil || application.ClientSecret != clientSecret {
|
if application == nil || application.ClientSecret != clientSecret {
|
||||||
c.ResponseError("invalid application or wrong clientSecret")
|
c.ResponseError("invalid application or wrong clientSecret")
|
||||||
|
c.Data["json"] = &object.TokenError{
|
||||||
|
Error: object.INVALID_CLIENT,
|
||||||
|
}
|
||||||
|
c.SetTokenErrorHttpStatus()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
token := object.GetTokenByTokenAndApplication(tokenValue, application.Name)
|
token := object.GetTokenByTokenAndApplication(tokenValue, application.Name)
|
||||||
|
@ -51,6 +51,23 @@ func (c *ApiController) ResponseError(error string, data ...interface{}) {
|
|||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetTokenErrorHttpStatus ...
|
||||||
|
func (c *ApiController) SetTokenErrorHttpStatus() {
|
||||||
|
_, ok := c.Data["json"].(*object.TokenError)
|
||||||
|
if ok {
|
||||||
|
if c.Data["json"].(*object.TokenError).Error == object.INVALID_CLIENT {
|
||||||
|
c.Ctx.Output.SetStatus(401)
|
||||||
|
c.Ctx.Output.Header("WWW-Authenticate", "Basic realm=\"OAuth2\"")
|
||||||
|
} else {
|
||||||
|
c.Ctx.Output.SetStatus(400)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_, ok = c.Data["json"].(*object.TokenWrapper)
|
||||||
|
if ok {
|
||||||
|
c.Ctx.Output.SetStatus(200)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// RequireSignedIn ...
|
// RequireSignedIn ...
|
||||||
func (c *ApiController) RequireSignedIn() (string, bool) {
|
func (c *ApiController) RequireSignedIn() (string, bool) {
|
||||||
userId := c.GetSessionUsername()
|
userId := c.GetSessionUsername()
|
||||||
|
@ -5,6 +5,7 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ./
|
context: ./
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
target: STANDARD
|
||||||
entrypoint: /bin/sh -c './server --createDatabase=true'
|
entrypoint: /bin/sh -c './server --createDatabase=true'
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
|
7
docker-entrypoint.sh
Normal file
7
docker-entrypoint.sh
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
service mariadb start
|
||||||
|
|
||||||
|
mysqladmin -u root password ${MYSQL_ROOT_PASSWORD}
|
||||||
|
|
||||||
|
exec /server --createDatabase=true
|
2
go.mod
2
go.mod
@ -11,7 +11,7 @@ require (
|
|||||||
github.com/casbin/casbin/v2 v2.30.1
|
github.com/casbin/casbin/v2 v2.30.1
|
||||||
github.com/casbin/xorm-adapter/v2 v2.5.1
|
github.com/casbin/xorm-adapter/v2 v2.5.1
|
||||||
github.com/casdoor/go-sms-sender v0.2.0
|
github.com/casdoor/go-sms-sender v0.2.0
|
||||||
github.com/casdoor/goth v1.69.0-FIX1
|
github.com/casdoor/goth v1.69.0-FIX2
|
||||||
github.com/casdoor/oss v1.2.0
|
github.com/casdoor/oss v1.2.0
|
||||||
github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f
|
github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f
|
||||||
github.com/go-gomail/gomail v0.0.0-20160411212932-81ebce5c23df
|
github.com/go-gomail/gomail v0.0.0-20160411212932-81ebce5c23df
|
||||||
|
4
go.sum
4
go.sum
@ -100,8 +100,8 @@ github.com/casbin/xorm-adapter/v2 v2.5.1 h1:BkpIxRHKa0s3bSMx173PpuU7oTs+Zw7XmD0B
|
|||||||
github.com/casbin/xorm-adapter/v2 v2.5.1/go.mod h1:AeH4dBKHC9/zYxzdPVHhPDzF8LYLqjDdb767CWJoV54=
|
github.com/casbin/xorm-adapter/v2 v2.5.1/go.mod h1:AeH4dBKHC9/zYxzdPVHhPDzF8LYLqjDdb767CWJoV54=
|
||||||
github.com/casdoor/go-sms-sender v0.2.0 h1:52bin4EBOPzOee64s9UK7jxd22FODvT9/+Y/Z+PSHpg=
|
github.com/casdoor/go-sms-sender v0.2.0 h1:52bin4EBOPzOee64s9UK7jxd22FODvT9/+Y/Z+PSHpg=
|
||||||
github.com/casdoor/go-sms-sender v0.2.0/go.mod h1:fsZsNnALvFIo+HFcE1U/oCQv4ZT42FdglXKMsEm3WSk=
|
github.com/casdoor/go-sms-sender v0.2.0/go.mod h1:fsZsNnALvFIo+HFcE1U/oCQv4ZT42FdglXKMsEm3WSk=
|
||||||
github.com/casdoor/goth v1.69.0-FIX1 h1:24Y3tfaJxWGJbxickGe3F9y2c8X1PgsQynhxGXV1f9Q=
|
github.com/casdoor/goth v1.69.0-FIX2 h1:RgfIMkL9kekylgxHHK2ZY8ASAwOGns2HVlaBwLu7Bcs=
|
||||||
github.com/casdoor/goth v1.69.0-FIX1/go.mod h1:Om55nRo8CkeDkPSNBbzXW4G5uI28ZUkSk5S69dPek3s=
|
github.com/casdoor/goth v1.69.0-FIX2/go.mod h1:Om55nRo8CkeDkPSNBbzXW4G5uI28ZUkSk5S69dPek3s=
|
||||||
github.com/casdoor/oss v1.2.0 h1:ozLAE+nnNdFQBWbzH8U9spzaO8h8NrB57lBcdyMUUQ8=
|
github.com/casdoor/oss v1.2.0 h1:ozLAE+nnNdFQBWbzH8U9spzaO8h8NrB57lBcdyMUUQ8=
|
||||||
github.com/casdoor/oss v1.2.0/go.mod h1:qii35VBuxnR/uEuYSKpS0aJ8htQFOcCVsZ4FHgHLuss=
|
github.com/casdoor/oss v1.2.0/go.mod h1:qii35VBuxnR/uEuYSKpS0aJ8htQFOcCVsZ4FHgHLuss=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
|
160
init_data.json.template
Normal file
160
init_data.json.template
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
{
|
||||||
|
"organizations": [
|
||||||
|
{
|
||||||
|
"owner": "",
|
||||||
|
"name": "",
|
||||||
|
"displayName": "",
|
||||||
|
"websiteUrl": "",
|
||||||
|
"favicon": "",
|
||||||
|
"passwordType": "",
|
||||||
|
"phonePrefix": "",
|
||||||
|
"defaultAvatar": "",
|
||||||
|
"tags": [""]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"applications": [
|
||||||
|
{
|
||||||
|
"owner": "",
|
||||||
|
"name": "",
|
||||||
|
"displayName": "",
|
||||||
|
"logo": "",
|
||||||
|
"homepageUrl": "",
|
||||||
|
"organization": "",
|
||||||
|
"cert": "",
|
||||||
|
"enablePassword": true,
|
||||||
|
"enableSignUp": true,
|
||||||
|
"clientId": "",
|
||||||
|
"clientSecret": "",
|
||||||
|
"providers": [
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"canSignUp": true,
|
||||||
|
"canSignIn": true,
|
||||||
|
"canUnlink": false,
|
||||||
|
"prompted": false,
|
||||||
|
"alertType": "None"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"signupItems": [
|
||||||
|
{
|
||||||
|
"name": "ID",
|
||||||
|
"visible": false,
|
||||||
|
"required": true,
|
||||||
|
"prompted": false,
|
||||||
|
"rule": "Random"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Username",
|
||||||
|
"visible": true,
|
||||||
|
"required": true,
|
||||||
|
"prompted": false,
|
||||||
|
"rule": "None"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Display name",
|
||||||
|
"visible": true,
|
||||||
|
"required": true,
|
||||||
|
"prompted": false,
|
||||||
|
"rule": "None"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Password",
|
||||||
|
"visible": true,
|
||||||
|
"required": true,
|
||||||
|
"prompted": false,
|
||||||
|
"rule": "None"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Confirm password",
|
||||||
|
"visible": true,
|
||||||
|
"required": true,
|
||||||
|
"prompted": false,
|
||||||
|
"rule": "None"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Email",
|
||||||
|
"visible": true,
|
||||||
|
"required": true,
|
||||||
|
"prompted": false,
|
||||||
|
"rule": "None"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Phone",
|
||||||
|
"visible": true,
|
||||||
|
"required": true,
|
||||||
|
"prompted": false,
|
||||||
|
"rule": "None"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Agreement",
|
||||||
|
"visible": true,
|
||||||
|
"required": true,
|
||||||
|
"prompted": false,
|
||||||
|
"rule": "None"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"redirectUris": [""],
|
||||||
|
"expireInHours": 168
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"users": [
|
||||||
|
{
|
||||||
|
"owner": "",
|
||||||
|
"name": "",
|
||||||
|
"type": "normal-user",
|
||||||
|
"password": "",
|
||||||
|
"displayName": "",
|
||||||
|
"avatar": "",
|
||||||
|
"email": "",
|
||||||
|
"phone": "",
|
||||||
|
"address": [],
|
||||||
|
"affiliation": "",
|
||||||
|
"tag": "",
|
||||||
|
"score": 2000,
|
||||||
|
"ranking": 1,
|
||||||
|
"isAdmin": true,
|
||||||
|
"isGlobalAdmin": true,
|
||||||
|
"isForbidden": false,
|
||||||
|
"isDeleted": false,
|
||||||
|
"signupApplication": "",
|
||||||
|
"createdIp": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"providers": [
|
||||||
|
{
|
||||||
|
"owner": "",
|
||||||
|
"name": "",
|
||||||
|
"displayName": "",
|
||||||
|
"category": "",
|
||||||
|
"type": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"certs": [
|
||||||
|
{
|
||||||
|
"owner": "",
|
||||||
|
"name": "",
|
||||||
|
"displayName": "",
|
||||||
|
"scope": "JWT",
|
||||||
|
"type": "x509",
|
||||||
|
"cryptoAlgorithm": "RS256",
|
||||||
|
"bitSize": 4096,
|
||||||
|
"expireInYears": 20,
|
||||||
|
"publicKey": "",
|
||||||
|
"privateKey": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ldaps": [
|
||||||
|
{
|
||||||
|
"id": "",
|
||||||
|
"owner": "",
|
||||||
|
"serverName": "",
|
||||||
|
"host": "",
|
||||||
|
"port": 389,
|
||||||
|
"admin": "",
|
||||||
|
"passwd": "",
|
||||||
|
"baseDn": "",
|
||||||
|
"autoSync": 0,
|
||||||
|
"lastSync": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
1
main.go
1
main.go
@ -36,6 +36,7 @@ func main() {
|
|||||||
|
|
||||||
object.InitAdapter(*createDatabase)
|
object.InitAdapter(*createDatabase)
|
||||||
object.InitDb()
|
object.InitDb()
|
||||||
|
object.InitFromFile()
|
||||||
object.InitDefaultStorageProvider()
|
object.InitDefaultStorageProvider()
|
||||||
object.InitLdapAutoSynchronizer()
|
object.InitLdapAutoSynchronizer()
|
||||||
proxy.InitHttpClient()
|
proxy.InitHttpClient()
|
||||||
|
@ -46,6 +46,7 @@ type Application struct {
|
|||||||
EnableSignUp bool `json:"enableSignUp"`
|
EnableSignUp bool `json:"enableSignUp"`
|
||||||
EnableSigninSession bool `json:"enableSigninSession"`
|
EnableSigninSession bool `json:"enableSigninSession"`
|
||||||
EnableCodeSignin bool `json:"enableCodeSignin"`
|
EnableCodeSignin bool `json:"enableCodeSignin"`
|
||||||
|
EnableSamlCompress bool `json:"enableSamlCompress"`
|
||||||
Providers []*ProviderItem `xorm:"mediumtext" json:"providers"`
|
Providers []*ProviderItem `xorm:"mediumtext" json:"providers"`
|
||||||
SignupItems []*SignupItem `xorm:"varchar(1000)" json:"signupItems"`
|
SignupItems []*SignupItem `xorm:"varchar(1000)" json:"signupItems"`
|
||||||
GrantTypes []string `xorm:"varchar(1000)" json:"grantTypes"`
|
GrantTypes []string `xorm:"varchar(1000)" json:"grantTypes"`
|
||||||
@ -279,8 +280,12 @@ func UpdateApplication(id string, application *Application) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func AddApplication(application *Application) bool {
|
func AddApplication(application *Application) bool {
|
||||||
application.ClientId = util.GenerateClientId()
|
if application.ClientId == "" {
|
||||||
application.ClientSecret = util.GenerateClientSecret()
|
application.ClientId = util.GenerateClientId()
|
||||||
|
}
|
||||||
|
if application.ClientSecret == "" {
|
||||||
|
application.ClientSecret = util.GenerateClientSecret()
|
||||||
|
}
|
||||||
for _, providerItem := range application.Providers {
|
for _, providerItem := range application.Providers {
|
||||||
providerItem.Provider = nil
|
providerItem.Provider = nil
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,10 @@ func downloadFile(url string) (*bytes.Buffer, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getPermanentAvatarUrl(organization string, username string, url string) string {
|
func getPermanentAvatarUrl(organization string, username string, url string) string {
|
||||||
|
if url == "" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
if defaultStorageProvider == nil {
|
if defaultStorageProvider == nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ func initBuiltInUser() {
|
|||||||
IsGlobalAdmin: true,
|
IsGlobalAdmin: true,
|
||||||
IsForbidden: false,
|
IsForbidden: false,
|
||||||
IsDeleted: false,
|
IsDeleted: false,
|
||||||
SignupApplication: "built-in-app",
|
SignupApplication: "app-built-in",
|
||||||
CreatedIp: "127.0.0.1",
|
CreatedIp: "127.0.0.1",
|
||||||
Properties: make(map[string]string),
|
Properties: make(map[string]string),
|
||||||
}
|
}
|
||||||
|
146
object/init_data.go
Normal file
146
object/init_data.go
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
// Copyright 2022 The Casdoor Authors. All Rights Reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package object
|
||||||
|
|
||||||
|
import "github.com/casdoor/casdoor/util"
|
||||||
|
|
||||||
|
type InitData struct {
|
||||||
|
Organizations []*Organization `json:"organizations"`
|
||||||
|
Applications []*Application `json:"applications"`
|
||||||
|
Users []*User `json:"users"`
|
||||||
|
Certs []*Cert `json:"certs"`
|
||||||
|
Providers []*Provider `json:"providers"`
|
||||||
|
Ldaps []*Ldap `json:"ldaps"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func InitFromFile() {
|
||||||
|
initData := readInitDataFromFile("./init_data.json")
|
||||||
|
if initData != nil {
|
||||||
|
for _, organization := range initData.Organizations {
|
||||||
|
initDefinedOrganization(organization)
|
||||||
|
}
|
||||||
|
for _, provider := range initData.Providers {
|
||||||
|
initDefinedProvider(provider)
|
||||||
|
}
|
||||||
|
for _, user := range initData.Users {
|
||||||
|
initDefinedUser(user)
|
||||||
|
}
|
||||||
|
for _, application := range initData.Applications {
|
||||||
|
initDefinedApplication(application)
|
||||||
|
}
|
||||||
|
for _, cert := range initData.Certs {
|
||||||
|
initDefinedCert(cert)
|
||||||
|
}
|
||||||
|
for _, ldap := range initData.Ldaps {
|
||||||
|
initDefinedLdap(ldap)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func readInitDataFromFile(filePath string) *InitData {
|
||||||
|
if !util.FileExist(filePath) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
s := util.ReadStringFromPath(filePath)
|
||||||
|
|
||||||
|
data := &InitData{}
|
||||||
|
err := util.JsonToStruct(s, data)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
func initDefinedOrganization(organization *Organization) {
|
||||||
|
existed := getOrganization(organization.Owner, organization.Name)
|
||||||
|
if existed != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
organization.CreatedTime = util.GetCurrentTime()
|
||||||
|
organization.AccountItems = []*AccountItem{
|
||||||
|
{Name: "Organization", Visible: true, ViewRule: "Public", ModifyRule: "Admin"},
|
||||||
|
{Name: "ID", Visible: true, ViewRule: "Public", ModifyRule: "Immutable"},
|
||||||
|
{Name: "Name", Visible: true, ViewRule: "Public", ModifyRule: "Admin"},
|
||||||
|
{Name: "Display name", Visible: true, ViewRule: "Public", ModifyRule: "Self"},
|
||||||
|
{Name: "Avatar", Visible: true, ViewRule: "Public", ModifyRule: "Self"},
|
||||||
|
{Name: "User type", Visible: true, ViewRule: "Public", ModifyRule: "Admin"},
|
||||||
|
{Name: "Password", Visible: true, ViewRule: "Self", ModifyRule: "Self"},
|
||||||
|
{Name: "Email", Visible: true, ViewRule: "Public", ModifyRule: "Self"},
|
||||||
|
{Name: "Phone", Visible: true, ViewRule: "Public", ModifyRule: "Self"},
|
||||||
|
{Name: "Country/Region", Visible: true, ViewRule: "Public", ModifyRule: "Self"},
|
||||||
|
{Name: "Location", Visible: true, ViewRule: "Public", ModifyRule: "Self"},
|
||||||
|
{Name: "Affiliation", Visible: true, ViewRule: "Public", ModifyRule: "Self"},
|
||||||
|
{Name: "Title", Visible: true, ViewRule: "Public", ModifyRule: "Self"},
|
||||||
|
{Name: "Homepage", Visible: true, ViewRule: "Public", ModifyRule: "Self"},
|
||||||
|
{Name: "Bio", Visible: true, ViewRule: "Public", ModifyRule: "Self"},
|
||||||
|
{Name: "Tag", Visible: true, ViewRule: "Public", ModifyRule: "Admin"},
|
||||||
|
{Name: "Signup application", Visible: true, ViewRule: "Public", ModifyRule: "Admin"},
|
||||||
|
{Name: "3rd-party logins", Visible: true, ViewRule: "Self", ModifyRule: "Self"},
|
||||||
|
{Name: "Properties", Visible: false, ViewRule: "Admin", ModifyRule: "Admin"},
|
||||||
|
{Name: "Is admin", Visible: true, ViewRule: "Admin", ModifyRule: "Admin"},
|
||||||
|
{Name: "Is global admin", Visible: true, ViewRule: "Admin", ModifyRule: "Admin"},
|
||||||
|
{Name: "Is forbidden", Visible: true, ViewRule: "Admin", ModifyRule: "Admin"},
|
||||||
|
{Name: "Is deleted", Visible: true, ViewRule: "Admin", ModifyRule: "Admin"},
|
||||||
|
}
|
||||||
|
|
||||||
|
AddOrganization(organization)
|
||||||
|
}
|
||||||
|
|
||||||
|
func initDefinedApplication(application *Application) {
|
||||||
|
existed := getApplication(application.Owner, application.Name)
|
||||||
|
if existed != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
application.CreatedTime = util.GetCurrentTime()
|
||||||
|
AddApplication(application)
|
||||||
|
}
|
||||||
|
|
||||||
|
func initDefinedUser(user *User) {
|
||||||
|
existed := getUser(user.Owner, user.Name)
|
||||||
|
if existed != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
user.CreatedTime = util.GetCurrentTime()
|
||||||
|
user.Id = util.GenerateId()
|
||||||
|
user.Properties = make(map[string]string)
|
||||||
|
AddUser(user)
|
||||||
|
}
|
||||||
|
|
||||||
|
func initDefinedCert(cert *Cert) {
|
||||||
|
existed := getCert(cert.Owner, cert.Name)
|
||||||
|
if existed != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
cert.CreatedTime = util.GetCurrentTime()
|
||||||
|
AddCert(cert)
|
||||||
|
}
|
||||||
|
|
||||||
|
func initDefinedLdap(ldap *Ldap) {
|
||||||
|
existed := GetLdap(ldap.Id)
|
||||||
|
if existed != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
AddLdap(ldap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func initDefinedProvider(provider *Provider) {
|
||||||
|
existed := GetProvider(provider.GetId())
|
||||||
|
if existed != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
AddProvider(provider)
|
||||||
|
}
|
@ -36,7 +36,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
//returns a saml2 response
|
//returns a saml2 response
|
||||||
func NewSamlResponse(user *User, host string, publicKey string, destination string, iss string, redirectUri []string) (*etree.Element, error) {
|
func NewSamlResponse(user *User, host string, publicKey string, destination string, iss string, requestId string, redirectUri []string) (*etree.Element, error) {
|
||||||
samlResponse := &etree.Element{
|
samlResponse := &etree.Element{
|
||||||
Space: "samlp",
|
Space: "samlp",
|
||||||
Tag: "Response",
|
Tag: "Response",
|
||||||
@ -51,7 +51,7 @@ func NewSamlResponse(user *User, host string, publicKey string, destination stri
|
|||||||
samlResponse.CreateAttr("Version", "2.0")
|
samlResponse.CreateAttr("Version", "2.0")
|
||||||
samlResponse.CreateAttr("IssueInstant", now)
|
samlResponse.CreateAttr("IssueInstant", now)
|
||||||
samlResponse.CreateAttr("Destination", destination)
|
samlResponse.CreateAttr("Destination", destination)
|
||||||
samlResponse.CreateAttr("InResponseTo", fmt.Sprintf("_%s", arId))
|
samlResponse.CreateAttr("InResponseTo", requestId)
|
||||||
samlResponse.CreateElement("saml:Issuer").SetText(host)
|
samlResponse.CreateElement("saml:Issuer").SetText(host)
|
||||||
|
|
||||||
samlResponse.CreateElement("samlp:Status").CreateElement("samlp:StatusCode").CreateAttr("Value", "urn:oasis:names:tc:SAML:2.0:status:Success")
|
samlResponse.CreateElement("samlp:Status").CreateElement("samlp:StatusCode").CreateAttr("Value", "urn:oasis:names:tc:SAML:2.0:status:Success")
|
||||||
@ -68,7 +68,7 @@ func NewSamlResponse(user *User, host string, publicKey string, destination stri
|
|||||||
subjectConfirmation := subject.CreateElement("saml:SubjectConfirmation")
|
subjectConfirmation := subject.CreateElement("saml:SubjectConfirmation")
|
||||||
subjectConfirmation.CreateAttr("Method", "urn:oasis:names:tc:SAML:2.0:cm:bearer")
|
subjectConfirmation.CreateAttr("Method", "urn:oasis:names:tc:SAML:2.0:cm:bearer")
|
||||||
subjectConfirmationData := subjectConfirmation.CreateElement("saml:SubjectConfirmationData")
|
subjectConfirmationData := subjectConfirmation.CreateElement("saml:SubjectConfirmationData")
|
||||||
subjectConfirmationData.CreateAttr("InResponseTo", fmt.Sprintf("_%s", arId))
|
subjectConfirmationData.CreateAttr("InResponseTo", requestId)
|
||||||
subjectConfirmationData.CreateAttr("Recipient", destination)
|
subjectConfirmationData.CreateAttr("Recipient", destination)
|
||||||
subjectConfirmationData.CreateAttr("NotOnOrAfter", expireTime)
|
subjectConfirmationData.CreateAttr("NotOnOrAfter", expireTime)
|
||||||
condition := assertion.CreateElement("saml:Conditions")
|
condition := assertion.CreateElement("saml:Conditions")
|
||||||
@ -225,14 +225,15 @@ func GetSamlMeta(application *Application, host string) (*IdpEntityDescriptor, e
|
|||||||
return &d, nil
|
return &d, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//GenerateSamlResponse generates a SAML2.0 response
|
// GetSamlResponse generates a SAML2.0 response
|
||||||
//parameter samlRequest is saml request in base64 format
|
// parameter samlRequest is saml request in base64 format
|
||||||
func GetSamlResponse(application *Application, user *User, samlRequest string, host string) (string, string, error) {
|
func GetSamlResponse(application *Application, user *User, samlRequest string, host string) (string, string, error) {
|
||||||
//decode samlRequest
|
// base64 decode
|
||||||
defated, err := base64.StdEncoding.DecodeString(samlRequest)
|
defated, err := base64.StdEncoding.DecodeString(samlRequest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", fmt.Errorf("err: %s", err.Error())
|
return "", "", fmt.Errorf("err: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
// decompress
|
||||||
var buffer bytes.Buffer
|
var buffer bytes.Buffer
|
||||||
rdr := flate.NewReader(bytes.NewReader(defated))
|
rdr := flate.NewReader(bytes.NewReader(defated))
|
||||||
io.Copy(&buffer, rdr)
|
io.Copy(&buffer, rdr)
|
||||||
@ -241,20 +242,21 @@ func GetSamlResponse(application *Application, user *User, samlRequest string, h
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", fmt.Errorf("err: %s", err.Error())
|
return "", "", fmt.Errorf("err: %s", err.Error())
|
||||||
}
|
}
|
||||||
//verify samlRequest
|
|
||||||
|
// verify samlRequest
|
||||||
if valid := CheckRedirectUriValid(application, authnRequest.Issuer.Url); !valid {
|
if valid := CheckRedirectUriValid(application, authnRequest.Issuer.Url); !valid {
|
||||||
return "", "", fmt.Errorf("err: invalid issuer url")
|
return "", "", fmt.Errorf("err: invalid issuer url")
|
||||||
}
|
}
|
||||||
|
|
||||||
//get publickey string
|
// get public key string
|
||||||
cert := getCertByApplication(application)
|
cert := getCertByApplication(application)
|
||||||
block, _ := pem.Decode([]byte(cert.PublicKey))
|
block, _ := pem.Decode([]byte(cert.PublicKey))
|
||||||
publicKey := base64.StdEncoding.EncodeToString(block.Bytes)
|
publicKey := base64.StdEncoding.EncodeToString(block.Bytes)
|
||||||
|
|
||||||
_, originBackend := getOriginFromHost(host)
|
_, originBackend := getOriginFromHost(host)
|
||||||
|
|
||||||
//build signedResponse
|
// build signedResponse
|
||||||
samlResponse, _ := NewSamlResponse(user, originBackend, publicKey, authnRequest.AssertionConsumerServiceURL, authnRequest.Issuer.Url, application.RedirectUris)
|
samlResponse, _ := NewSamlResponse(user, originBackend, publicKey, authnRequest.AssertionConsumerServiceURL, authnRequest.Issuer.Url, authnRequest.ID, application.RedirectUris)
|
||||||
randomKeyStore := &X509Key{
|
randomKeyStore := &X509Key{
|
||||||
PrivateKey: cert.PrivateKey,
|
PrivateKey: cert.PrivateKey,
|
||||||
X509Certificate: publicKey,
|
X509Certificate: publicKey,
|
||||||
@ -270,15 +272,28 @@ func GetSamlResponse(application *Application, user *User, samlRequest string, h
|
|||||||
|
|
||||||
doc := etree.NewDocument()
|
doc := etree.NewDocument()
|
||||||
doc.SetRoot(samlResponse)
|
doc.SetRoot(samlResponse)
|
||||||
xmlStr, err := doc.WriteToString()
|
xmlBytes, err := doc.WriteToBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", fmt.Errorf("err: %s", err.Error())
|
return "", "", fmt.Errorf("err: %s", err.Error())
|
||||||
}
|
}
|
||||||
res := base64.StdEncoding.EncodeToString([]byte(xmlStr))
|
|
||||||
|
// compress
|
||||||
|
if application.EnableSamlCompress {
|
||||||
|
flated := bytes.NewBuffer(nil)
|
||||||
|
writer, err := flate.NewWriter(flated, flate.DefaultCompression)
|
||||||
|
if err != nil {
|
||||||
|
return "", "", fmt.Errorf("err: %s", err.Error())
|
||||||
|
}
|
||||||
|
writer.Write(xmlBytes)
|
||||||
|
writer.Close()
|
||||||
|
xmlBytes = flated.Bytes()
|
||||||
|
}
|
||||||
|
// base64 encode
|
||||||
|
res := base64.StdEncoding.EncodeToString(xmlBytes)
|
||||||
return res, authnRequest.AssertionConsumerServiceURL, nil
|
return res, authnRequest.AssertionConsumerServiceURL, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//return a saml1.1 response(not 2.0)
|
// NewSamlResponse11 return a saml1.1 response(not 2.0)
|
||||||
func NewSamlResponse11(user *User, requestID string, host string) *etree.Element {
|
func NewSamlResponse11(user *User, requestID string, host string) *etree.Element {
|
||||||
samlResponse := &etree.Element{
|
samlResponse := &etree.Element{
|
||||||
Space: "samlp",
|
Space: "samlp",
|
||||||
|
232
object/token.go
232
object/token.go
@ -17,7 +17,6 @@ package object
|
|||||||
import (
|
import (
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -28,7 +27,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
hourSeconds = 3600
|
hourSeconds = 3600
|
||||||
|
INVALID_REQUEST = "invalid_request"
|
||||||
|
INVALID_CLIENT = "invalid_client"
|
||||||
|
INVALID_GRANT = "invalid_grant"
|
||||||
|
UNAUTHORIZED_CLIENT = "unauthorized_client"
|
||||||
|
UNSUPPORTED_GRANT_TYPE = "unsupported_grant_type"
|
||||||
|
INVALID_SCOPE = "invalid_scope"
|
||||||
|
ENDPOINT_ERROR = "endpoint_error"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Code struct {
|
type Code struct {
|
||||||
@ -63,7 +69,11 @@ type TokenWrapper struct {
|
|||||||
TokenType string `json:"token_type"`
|
TokenType string `json:"token_type"`
|
||||||
ExpiresIn int `json:"expires_in"`
|
ExpiresIn int `json:"expires_in"`
|
||||||
Scope string `json:"scope"`
|
Scope string `json:"scope"`
|
||||||
Error string `json:"error,omitempty"`
|
}
|
||||||
|
|
||||||
|
type TokenError struct {
|
||||||
|
Error string `json:"error"`
|
||||||
|
ErrorDescription string `json:"error_description,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type IntrospectionResponse struct {
|
type IntrospectionResponse struct {
|
||||||
@ -311,59 +321,42 @@ func GetOAuthCode(userId string, clientId string, responseType string, redirectU
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetOAuthToken(grantType string, clientId string, clientSecret string, code string, verifier string, scope string, username string, password string, host string, tag string, avatar string) interface{} {
|
||||||
func GetOAuthToken(grantType string, clientId string, clientSecret string, code string, verifier string, scope string, username string, password string, host string, tag string, avatar string) *TokenWrapper {
|
|
||||||
var errString string
|
|
||||||
application := GetApplicationByClientId(clientId)
|
application := GetApplicationByClientId(clientId)
|
||||||
if application == nil {
|
if application == nil {
|
||||||
errString = "error: invalid client_id"
|
return &TokenError{
|
||||||
return &TokenWrapper{
|
Error: INVALID_CLIENT,
|
||||||
AccessToken: errString,
|
ErrorDescription: "client_id is invalid",
|
||||||
TokenType: "",
|
|
||||||
ExpiresIn: 0,
|
|
||||||
Scope: "",
|
|
||||||
Error: errString,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if grantType is allowed in the current application
|
//Check if grantType is allowed in the current application
|
||||||
|
|
||||||
if !IsGrantTypeValid(grantType, application.GrantTypes) && tag == "" {
|
if !IsGrantTypeValid(grantType, application.GrantTypes) && tag == "" {
|
||||||
errString = fmt.Sprintf("error: grant_type: %s is not supported in this application", grantType)
|
return &TokenError{
|
||||||
return &TokenWrapper{
|
Error: UNSUPPORTED_GRANT_TYPE,
|
||||||
AccessToken: errString,
|
ErrorDescription: fmt.Sprintf("grant_type: %s is not supported in this application", grantType),
|
||||||
TokenType: "",
|
|
||||||
ExpiresIn: 0,
|
|
||||||
Scope: "",
|
|
||||||
Error: errString,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var token *Token
|
var token *Token
|
||||||
var err error
|
var tokenError *TokenError
|
||||||
switch grantType {
|
switch grantType {
|
||||||
case "authorization_code": // Authorization Code Grant
|
case "authorization_code": // Authorization Code Grant
|
||||||
token, err = GetAuthorizationCodeToken(application, clientSecret, code, verifier)
|
token, tokenError = GetAuthorizationCodeToken(application, clientSecret, code, verifier)
|
||||||
case "password": // Resource Owner Password Credentials Grant
|
case "password": // Resource Owner Password Credentials Grant
|
||||||
token, err = GetPasswordToken(application, username, password, scope, host)
|
token, tokenError = GetPasswordToken(application, username, password, scope, host)
|
||||||
case "client_credentials": // Client Credentials Grant
|
case "client_credentials": // Client Credentials Grant
|
||||||
token, err = GetClientCredentialsToken(application, clientSecret, scope, host)
|
token, tokenError = GetClientCredentialsToken(application, clientSecret, scope, host)
|
||||||
}
|
}
|
||||||
|
|
||||||
if tag == "wechat_miniprogram" {
|
if tag == "wechat_miniprogram" {
|
||||||
// Wechat Mini Program
|
// Wechat Mini Program
|
||||||
token, err = GetWechatMiniProgramToken(application, code, host, username, avatar)
|
token, tokenError = GetWechatMiniProgramToken(application, code, host, username, avatar)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if tokenError != nil {
|
||||||
errString = err.Error()
|
return tokenError
|
||||||
return &TokenWrapper{
|
|
||||||
AccessToken: errString,
|
|
||||||
TokenType: "",
|
|
||||||
ExpiresIn: 0,
|
|
||||||
Scope: "",
|
|
||||||
Error: errString,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
token.CodeIsUsed = true
|
token.CodeIsUsed = true
|
||||||
@ -380,81 +373,59 @@ func GetOAuthToken(grantType string, clientId string, clientSecret string, code
|
|||||||
return tokenWrapper
|
return tokenWrapper
|
||||||
}
|
}
|
||||||
|
|
||||||
func RefreshToken(grantType string, refreshToken string, scope string, clientId string, clientSecret string, host string) *TokenWrapper {
|
func RefreshToken(grantType string, refreshToken string, scope string, clientId string, clientSecret string, host string) interface{} {
|
||||||
var errString string
|
|
||||||
// check parameters
|
// check parameters
|
||||||
if grantType != "refresh_token" {
|
if grantType != "refresh_token" {
|
||||||
errString = "error: grant_type should be \"refresh_token\""
|
return &TokenError{
|
||||||
return &TokenWrapper{
|
Error: UNSUPPORTED_GRANT_TYPE,
|
||||||
AccessToken: errString,
|
ErrorDescription: "grant_type should be refresh_token",
|
||||||
TokenType: "",
|
|
||||||
ExpiresIn: 0,
|
|
||||||
Scope: "",
|
|
||||||
Error: errString,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
application := GetApplicationByClientId(clientId)
|
application := GetApplicationByClientId(clientId)
|
||||||
if application == nil {
|
if application == nil {
|
||||||
errString = "error: invalid client_id"
|
return &TokenError{
|
||||||
return &TokenWrapper{
|
Error: INVALID_CLIENT,
|
||||||
AccessToken: errString,
|
ErrorDescription: "client_id is invalid",
|
||||||
TokenType: "",
|
|
||||||
ExpiresIn: 0,
|
|
||||||
Scope: "",
|
|
||||||
Error: errString,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if clientSecret != "" && application.ClientSecret != clientSecret {
|
if clientSecret != "" && application.ClientSecret != clientSecret {
|
||||||
errString = "error: invalid client_secret"
|
return &TokenError{
|
||||||
return &TokenWrapper{
|
Error: INVALID_CLIENT,
|
||||||
AccessToken: errString,
|
ErrorDescription: "client_secret is invalid",
|
||||||
TokenType: "",
|
|
||||||
ExpiresIn: 0,
|
|
||||||
Scope: "",
|
|
||||||
Error: errString,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check whether the refresh token is valid, and has not expired.
|
// check whether the refresh token is valid, and has not expired.
|
||||||
token := Token{RefreshToken: refreshToken}
|
token := Token{RefreshToken: refreshToken}
|
||||||
existed, err := adapter.Engine.Get(&token)
|
existed, err := adapter.Engine.Get(&token)
|
||||||
if err != nil || !existed {
|
if err != nil || !existed {
|
||||||
errString = "error: invalid refresh_token"
|
return &TokenError{
|
||||||
return &TokenWrapper{
|
Error: INVALID_GRANT,
|
||||||
AccessToken: errString,
|
ErrorDescription: "refresh token is invalid, expired or revoked",
|
||||||
TokenType: "",
|
|
||||||
ExpiresIn: 0,
|
|
||||||
Scope: "",
|
|
||||||
Error: errString,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cert := getCertByApplication(application)
|
cert := getCertByApplication(application)
|
||||||
_, err = ParseJwtToken(refreshToken, cert)
|
_, err = ParseJwtToken(refreshToken, cert)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errString := fmt.Sprintf("error: %s", err.Error())
|
return &TokenError{
|
||||||
return &TokenWrapper{
|
Error: INVALID_GRANT,
|
||||||
AccessToken: errString,
|
ErrorDescription: fmt.Sprintf("parse refresh token error: %s", err.Error()),
|
||||||
TokenType: "",
|
|
||||||
ExpiresIn: 0,
|
|
||||||
Scope: "",
|
|
||||||
Error: errString,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// generate a new token
|
// generate a new token
|
||||||
user := getUser(application.Organization, token.User)
|
user := getUser(application.Organization, token.User)
|
||||||
if user.IsForbidden {
|
if user.IsForbidden {
|
||||||
errString = "error: the user is forbidden to sign in, please contact the administrator"
|
return &TokenError{
|
||||||
return &TokenWrapper{
|
Error: INVALID_GRANT,
|
||||||
AccessToken: errString,
|
ErrorDescription: "the user is forbidden to sign in, please contact the administrator",
|
||||||
TokenType: "",
|
|
||||||
ExpiresIn: 0,
|
|
||||||
Scope: "",
|
|
||||||
Error: errString,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newAccessToken, newRefreshToken, err := generateJwtToken(application, user, "", scope, host)
|
newAccessToken, newRefreshToken, err := generateJwtToken(application, user, "", scope, host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
return &TokenError{
|
||||||
|
Error: ENDPOINT_ERROR,
|
||||||
|
ErrorDescription: fmt.Sprintf("generate jwt token error: %s", err.Error()),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newToken := &Token{
|
newToken := &Token{
|
||||||
@ -508,63 +479,99 @@ func IsGrantTypeValid(method string, grantTypes []string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Authorization code flow
|
// Authorization code flow
|
||||||
func GetAuthorizationCodeToken(application *Application, clientSecret string, code string, verifier string) (*Token, error) {
|
func GetAuthorizationCodeToken(application *Application, clientSecret string, code string, verifier string) (*Token, *TokenError) {
|
||||||
if code == "" {
|
if code == "" {
|
||||||
return nil, errors.New("error: authorization code should not be empty")
|
return nil, &TokenError{
|
||||||
|
Error: INVALID_REQUEST,
|
||||||
|
ErrorDescription: "authorization code should not be empty",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
token := getTokenByCode(code)
|
token := getTokenByCode(code)
|
||||||
if token == nil {
|
if token == nil {
|
||||||
return nil, errors.New("error: invalid authorization code")
|
return nil, &TokenError{
|
||||||
|
Error: INVALID_GRANT,
|
||||||
|
ErrorDescription: "authorization code is invalid",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if token.CodeIsUsed {
|
if token.CodeIsUsed {
|
||||||
// anti replay attacks
|
// anti replay attacks
|
||||||
return nil, errors.New("error: authorization code has been used")
|
return nil, &TokenError{
|
||||||
|
Error: INVALID_GRANT,
|
||||||
|
ErrorDescription: "authorization code has been used",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if token.CodeChallenge != "" && pkceChallenge(verifier) != token.CodeChallenge {
|
if token.CodeChallenge != "" && pkceChallenge(verifier) != token.CodeChallenge {
|
||||||
return nil, errors.New("error: incorrect code_verifier")
|
return nil, &TokenError{
|
||||||
|
Error: INVALID_GRANT,
|
||||||
|
ErrorDescription: "verifier is invalid",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if application.ClientSecret != clientSecret {
|
if application.ClientSecret != clientSecret {
|
||||||
// when using PKCE, the Client Secret can be empty,
|
// when using PKCE, the Client Secret can be empty,
|
||||||
// but if it is provided, it must be accurate.
|
// but if it is provided, it must be accurate.
|
||||||
if token.CodeChallenge == "" {
|
if token.CodeChallenge == "" {
|
||||||
return nil, errors.New("error: invalid client_secret")
|
return nil, &TokenError{
|
||||||
|
Error: INVALID_CLIENT,
|
||||||
|
ErrorDescription: "client_secret is invalid",
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if clientSecret != "" {
|
if clientSecret != "" {
|
||||||
return nil, errors.New("error: invalid client_secret")
|
return nil, &TokenError{
|
||||||
|
Error: INVALID_CLIENT,
|
||||||
|
ErrorDescription: "client_secret is invalid",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if application.Name != token.Application {
|
if application.Name != token.Application {
|
||||||
return nil, errors.New("error: the token is for wrong application (client_id)")
|
return nil, &TokenError{
|
||||||
|
Error: INVALID_GRANT,
|
||||||
|
ErrorDescription: "the token is for wrong application (client_id)",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if time.Now().Unix() > token.CodeExpireIn {
|
if time.Now().Unix() > token.CodeExpireIn {
|
||||||
// code must be used within 5 minutes
|
// code must be used within 5 minutes
|
||||||
return nil, errors.New("error: authorization code has expired")
|
return nil, &TokenError{
|
||||||
|
Error: INVALID_GRANT,
|
||||||
|
ErrorDescription: "authorization code has expired",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return token, nil
|
return token, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resource Owner Password Credentials flow
|
// Resource Owner Password Credentials flow
|
||||||
func GetPasswordToken(application *Application, username string, password string, scope string, host string) (*Token, error) {
|
func GetPasswordToken(application *Application, username string, password string, scope string, host string) (*Token, *TokenError) {
|
||||||
user := getUser(application.Organization, username)
|
user := getUser(application.Organization, username)
|
||||||
if user == nil {
|
if user == nil {
|
||||||
return nil, errors.New("error: the user does not exist")
|
return nil, &TokenError{
|
||||||
|
Error: INVALID_GRANT,
|
||||||
|
ErrorDescription: "the user does not exist",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
msg := CheckPassword(user, password)
|
msg := CheckPassword(user, password)
|
||||||
if msg != "" {
|
if msg != "" {
|
||||||
return nil, errors.New("error: invalid username or password")
|
return nil, &TokenError{
|
||||||
|
Error: INVALID_GRANT,
|
||||||
|
ErrorDescription: "invalid username or password",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if user.IsForbidden {
|
if user.IsForbidden {
|
||||||
return nil, errors.New("error: the user is forbidden to sign in, please contact the administrator")
|
return nil, &TokenError{
|
||||||
|
Error: INVALID_GRANT,
|
||||||
|
ErrorDescription: "the user is forbidden to sign in, please contact the administrator",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
accessToken, refreshToken, err := generateJwtToken(application, user, "", scope, host)
|
accessToken, refreshToken, err := generateJwtToken(application, user, "", scope, host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, &TokenError{
|
||||||
|
Error: ENDPOINT_ERROR,
|
||||||
|
ErrorDescription: fmt.Sprintf("generate jwt token error: %s", err.Error()),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
token := &Token{
|
token := &Token{
|
||||||
Owner: application.Owner,
|
Owner: application.Owner,
|
||||||
@ -586,9 +593,12 @@ func GetPasswordToken(application *Application, username string, password string
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Client Credentials flow
|
// Client Credentials flow
|
||||||
func GetClientCredentialsToken(application *Application, clientSecret string, scope string, host string) (*Token, error) {
|
func GetClientCredentialsToken(application *Application, clientSecret string, scope string, host string) (*Token, *TokenError) {
|
||||||
if application.ClientSecret != clientSecret {
|
if application.ClientSecret != clientSecret {
|
||||||
return nil, errors.New("error: invalid client_secret")
|
return nil, &TokenError{
|
||||||
|
Error: INVALID_CLIENT,
|
||||||
|
ErrorDescription: "client_secret is invalid",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
nullUser := &User{
|
nullUser := &User{
|
||||||
Owner: application.Owner,
|
Owner: application.Owner,
|
||||||
@ -597,7 +607,10 @@ func GetClientCredentialsToken(application *Application, clientSecret string, sc
|
|||||||
}
|
}
|
||||||
accessToken, _, err := generateJwtToken(application, nullUser, "", scope, host)
|
accessToken, _, err := generateJwtToken(application, nullUser, "", scope, host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, &TokenError{
|
||||||
|
Error: ENDPOINT_ERROR,
|
||||||
|
ErrorDescription: fmt.Sprintf("generate jwt token error: %s", err.Error()),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
token := &Token{
|
token := &Token{
|
||||||
Owner: application.Owner,
|
Owner: application.Owner,
|
||||||
@ -643,25 +656,37 @@ func GetTokenByUser(application *Application, user *User, scope string, host str
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Wechat Mini Program flow
|
// Wechat Mini Program flow
|
||||||
func GetWechatMiniProgramToken(application *Application, code string, host string, username string, avatar string) (*Token, error) {
|
func GetWechatMiniProgramToken(application *Application, code string, host string, username string, avatar string) (*Token, *TokenError) {
|
||||||
mpProvider := GetWechatMiniProgramProvider(application)
|
mpProvider := GetWechatMiniProgramProvider(application)
|
||||||
if mpProvider == nil {
|
if mpProvider == nil {
|
||||||
return nil, errors.New("error: the application does not support wechat mini program")
|
return nil, &TokenError{
|
||||||
|
Error: INVALID_CLIENT,
|
||||||
|
ErrorDescription: "the application does not support wechat mini program",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
provider := GetProvider(util.GetId(mpProvider.Name))
|
provider := GetProvider(util.GetId(mpProvider.Name))
|
||||||
mpIdp := idp.NewWeChatMiniProgramIdProvider(provider.ClientId, provider.ClientSecret)
|
mpIdp := idp.NewWeChatMiniProgramIdProvider(provider.ClientId, provider.ClientSecret)
|
||||||
session, err := mpIdp.GetSessionByCode(code)
|
session, err := mpIdp.GetSessionByCode(code)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, &TokenError{
|
||||||
|
Error: INVALID_GRANT,
|
||||||
|
ErrorDescription: fmt.Sprintf("get wechat mini program session error: %s", err.Error()),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
openId, unionId := session.Openid, session.Unionid
|
openId, unionId := session.Openid, session.Unionid
|
||||||
if openId == "" && unionId == "" {
|
if openId == "" && unionId == "" {
|
||||||
return nil, errors.New("err: WeChat's openid and unionid are empty")
|
return nil, &TokenError{
|
||||||
|
Error: INVALID_REQUEST,
|
||||||
|
ErrorDescription: "the wechat mini program session is invalid",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
user := getUserByWechatId(openId, unionId)
|
user := getUserByWechatId(openId, unionId)
|
||||||
if user == nil {
|
if user == nil {
|
||||||
if !application.EnableSignUp {
|
if !application.EnableSignUp {
|
||||||
return nil, errors.New("err: the application does not allow to sign up new account")
|
return nil, &TokenError{
|
||||||
|
Error: INVALID_GRANT,
|
||||||
|
ErrorDescription: "the application does not allow to sign up new account",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//Add new user
|
//Add new user
|
||||||
var name string
|
var name string
|
||||||
@ -691,7 +716,10 @@ func GetWechatMiniProgramToken(application *Application, code string, host strin
|
|||||||
|
|
||||||
accessToken, refreshToken, err := generateJwtToken(application, user, "", "", host)
|
accessToken, refreshToken, err := generateJwtToken(application, user, "", "", host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, &TokenError{
|
||||||
|
Error: ENDPOINT_ERROR,
|
||||||
|
ErrorDescription: fmt.Sprintf("generate jwt token error: %s", err.Error()),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
token := &Token{
|
token := &Token{
|
||||||
|
@ -76,7 +76,7 @@ func getProxyHttpClient() *http.Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetHttpClient(url string) *http.Client {
|
func GetHttpClient(url string) *http.Client {
|
||||||
if strings.Contains(url, "githubusercontent.com") {
|
if strings.Contains(url, "githubusercontent.com") || strings.Contains(url, "googleusercontent.com") {
|
||||||
return ProxyHttpClient
|
return ProxyHttpClient
|
||||||
} else {
|
} else {
|
||||||
return DefaultHttpClient
|
return DefaultHttpClient
|
||||||
|
@ -1,9 +1,24 @@
|
|||||||
|
// Copyright 2021 The Casdoor Authors. All Rights Reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
package routers
|
package routers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/astaxie/beego/context"
|
"github.com/astaxie/beego/context"
|
||||||
|
"github.com/casdoor/casdoor/conf"
|
||||||
"github.com/casdoor/casdoor/object"
|
"github.com/casdoor/casdoor/object"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -15,17 +30,22 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func CorsFilter(ctx *context.Context) {
|
func CorsFilter(ctx *context.Context) {
|
||||||
if ctx.Input.Method() == "OPTIONS" {
|
origin := ctx.Input.Header(headerOrigin)
|
||||||
origin := ctx.Input.Header(headerOrigin)
|
originConf := conf.GetConfigString("origin")
|
||||||
|
|
||||||
|
if origin != "" && originConf != "" && origin != originConf {
|
||||||
if object.IsAllowOrigin(origin) {
|
if object.IsAllowOrigin(origin) {
|
||||||
ctx.Output.Header(headerAllowOrigin, origin)
|
ctx.Output.Header(headerAllowOrigin, origin)
|
||||||
ctx.Output.Header(headerAllowMethods, "POST, GET, OPTIONS")
|
ctx.Output.Header(headerAllowMethods, "POST, GET, OPTIONS")
|
||||||
ctx.Output.Header(headerAllowHeaders, "Content-Type, Authorization")
|
ctx.Output.Header(headerAllowHeaders, "Content-Type, Authorization")
|
||||||
ctx.ResponseWriter.WriteHeader(http.StatusOK)
|
|
||||||
} else {
|
} else {
|
||||||
ctx.ResponseWriter.WriteHeader(http.StatusForbidden)
|
ctx.ResponseWriter.WriteHeader(http.StatusForbidden)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if ctx.Input.Method() == "OPTIONS" {
|
||||||
|
ctx.ResponseWriter.WriteHeader(http.StatusOK)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2194,6 +2194,18 @@
|
|||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/object.TokenWrapper"
|
"$ref": "#/definitions/object.TokenWrapper"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "The Response object",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/object.TokenError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"description": "The Response object",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/object.TokenError"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2285,6 +2297,18 @@
|
|||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/object.IntrospectionResponse"
|
"$ref": "#/definitions/object.IntrospectionResponse"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "The Response object",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/object.TokenError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"description": "The Response object",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/object.TokenError"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2377,6 +2401,18 @@
|
|||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/object.TokenWrapper"
|
"$ref": "#/definitions/object.TokenWrapper"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "The Response object",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/object.TokenError"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"description": "The Response object",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/object.TokenError"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3063,11 +3099,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
"2200.0xc0003c4b70.false": {
|
"2127.0xc000398090.false": {
|
||||||
"title": "false",
|
"title": "false",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"2235.0xc0003c4ba0.false": {
|
"2161.0xc0003980c0.false": {
|
||||||
"title": "false",
|
"title": "false",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
@ -3082,6 +3118,9 @@
|
|||||||
"content": {
|
"content": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"provider": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"receivers": {
|
"receivers": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
@ -3182,10 +3221,10 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"data": {
|
"data": {
|
||||||
"$ref": "#/definitions/2200.0xc0003c4b70.false"
|
"$ref": "#/definitions/2127.0xc000398090.false"
|
||||||
},
|
},
|
||||||
"data2": {
|
"data2": {
|
||||||
"$ref": "#/definitions/2235.0xc0003c4ba0.false"
|
"$ref": "#/definitions/2161.0xc0003980c0.false"
|
||||||
},
|
},
|
||||||
"msg": {
|
"msg": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@ -4209,6 +4248,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"object.TokenError": {
|
||||||
|
"title": "TokenError",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"error": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"error_description": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"object.TokenWrapper": {
|
"object.TokenWrapper": {
|
||||||
"title": "TokenWrapper",
|
"title": "TokenWrapper",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@ -4216,9 +4267,6 @@
|
|||||||
"access_token": {
|
"access_token": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"error": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"expires_in": {
|
"expires_in": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"format": "int64"
|
"format": "int64"
|
||||||
|
@ -1435,6 +1435,14 @@ paths:
|
|||||||
description: The Response object
|
description: The Response object
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/object.TokenWrapper'
|
$ref: '#/definitions/object.TokenWrapper'
|
||||||
|
"400":
|
||||||
|
description: The Response object
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/object.TokenError'
|
||||||
|
"401":
|
||||||
|
description: The Response object
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/object.TokenError'
|
||||||
/api/login/oauth/code:
|
/api/login/oauth/code:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@ -1497,6 +1505,14 @@ paths:
|
|||||||
description: The Response object
|
description: The Response object
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/object.IntrospectionResponse'
|
$ref: '#/definitions/object.IntrospectionResponse'
|
||||||
|
"400":
|
||||||
|
description: The Response object
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/object.TokenError'
|
||||||
|
"401":
|
||||||
|
description: The Response object
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/object.TokenError'
|
||||||
/api/login/oauth/logout:
|
/api/login/oauth/logout:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
@ -1559,6 +1575,14 @@ paths:
|
|||||||
description: The Response object
|
description: The Response object
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/object.TokenWrapper'
|
$ref: '#/definitions/object.TokenWrapper'
|
||||||
|
"400":
|
||||||
|
description: The Response object
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/object.TokenError'
|
||||||
|
"401":
|
||||||
|
description: The Response object
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/object.TokenError'
|
||||||
/api/logout:
|
/api/logout:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@ -2005,10 +2029,10 @@ paths:
|
|||||||
- Verification API
|
- Verification API
|
||||||
operationId: ApiController.VerifyCaptcha
|
operationId: ApiController.VerifyCaptcha
|
||||||
definitions:
|
definitions:
|
||||||
2200.0xc0003c4b70.false:
|
2127.0xc000398090.false:
|
||||||
title: "false"
|
title: "false"
|
||||||
type: object
|
type: object
|
||||||
2235.0xc0003c4ba0.false:
|
2161.0xc0003980c0.false:
|
||||||
title: "false"
|
title: "false"
|
||||||
type: object
|
type: object
|
||||||
Response:
|
Response:
|
||||||
@ -2020,6 +2044,8 @@ definitions:
|
|||||||
properties:
|
properties:
|
||||||
content:
|
content:
|
||||||
type: string
|
type: string
|
||||||
|
provider:
|
||||||
|
type: string
|
||||||
receivers:
|
receivers:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
@ -2087,9 +2113,9 @@ definitions:
|
|||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
data:
|
data:
|
||||||
$ref: '#/definitions/2200.0xc0003c4b70.false'
|
$ref: '#/definitions/2127.0xc000398090.false'
|
||||||
data2:
|
data2:
|
||||||
$ref: '#/definitions/2235.0xc0003c4ba0.false'
|
$ref: '#/definitions/2161.0xc0003980c0.false'
|
||||||
msg:
|
msg:
|
||||||
type: string
|
type: string
|
||||||
name:
|
name:
|
||||||
@ -2776,14 +2802,20 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
user:
|
user:
|
||||||
type: string
|
type: string
|
||||||
|
object.TokenError:
|
||||||
|
title: TokenError
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
error:
|
||||||
|
type: string
|
||||||
|
error_description:
|
||||||
|
type: string
|
||||||
object.TokenWrapper:
|
object.TokenWrapper:
|
||||||
title: TokenWrapper
|
title: TokenWrapper
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
access_token:
|
access_token:
|
||||||
type: string
|
type: string
|
||||||
error:
|
|
||||||
type: string
|
|
||||||
expires_in:
|
expires_in:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
|
30
util/crypto.go
Normal file
30
util/crypto.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright 2022 The Casdoor Authors. All Rights Reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package util
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/hmac"
|
||||||
|
"crypto/sha1"
|
||||||
|
"encoding/base64"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetHmacSha1(keyStr, value string) string {
|
||||||
|
key := []byte(keyStr)
|
||||||
|
mac := hmac.New(sha1.New, key)
|
||||||
|
mac.Write([]byte(value))
|
||||||
|
res := base64.StdEncoding.EncodeToString(mac.Sum(nil))
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
@ -663,24 +663,29 @@ class App extends Component {
|
|||||||
renderPage() {
|
renderPage() {
|
||||||
if (this.isDoorPages()) {
|
if (this.isDoorPages()) {
|
||||||
return (
|
return (
|
||||||
<Switch>
|
<div>
|
||||||
<Route exact path="/signup" render={(props) => this.renderHomeIfLoggedIn(<SignupPage account={this.state.account} {...props} />)}/>
|
<Switch>
|
||||||
<Route exact path="/signup/:applicationName" render={(props) => this.renderHomeIfLoggedIn(<SignupPage account={this.state.account} {...props} onUpdateAccount={(account) => {this.onUpdateAccount(account)}} />)}/>
|
<Route exact path="/signup" render={(props) => this.renderHomeIfLoggedIn(<SignupPage account={this.state.account} {...props} />)}/>
|
||||||
<Route exact path="/login" render={(props) => this.renderHomeIfLoggedIn(<SelfLoginPage account={this.state.account} {...props} />)}/>
|
<Route exact path="/signup/:applicationName" render={(props) => this.renderHomeIfLoggedIn(<SignupPage account={this.state.account} {...props} onUpdateAccount={(account) => {this.onUpdateAccount(account)}} />)}/>
|
||||||
<Route exact path="/signup/oauth/authorize" render={(props) => <LoginPage account={this.state.account} type={"code"} mode={"signup"} {...props} onUpdateAccount={(account) => {this.onUpdateAccount(account)}} />}/>
|
<Route exact path="/login" render={(props) => this.renderHomeIfLoggedIn(<SelfLoginPage account={this.state.account} {...props} />)}/>
|
||||||
<Route exact path="/login/oauth/authorize" render={(props) => <LoginPage account={this.state.account} type={"code"} mode={"signin"} {...props} onUpdateAccount={(account) => {this.onUpdateAccount(account)}} />}/>
|
<Route exact path="/signup/oauth/authorize" render={(props) => <LoginPage account={this.state.account} type={"code"} mode={"signup"} {...props} onUpdateAccount={(account) => {this.onUpdateAccount(account)}} />}/>
|
||||||
<Route exact path="/login/saml/authorize/:owner/:applicationName" render={(props) => <LoginPage account={this.state.account} type={"saml"} mode={"signin"} {...props} onUpdateAccount={(account) => {this.onUpdateAccount(account)}} />}/>
|
<Route exact path="/login/oauth/authorize" render={(props) => <LoginPage account={this.state.account} type={"code"} mode={"signin"} {...props} onUpdateAccount={(account) => {this.onUpdateAccount(account)}} />}/>
|
||||||
<Route exact path="/cas/:owner/:casApplicationName/logout" render={(props) => this.renderHomeIfLoggedIn(<CasLogout clearAccount={() => this.setState({account: null})} {...props} />)} />
|
<Route exact path="/login/saml/authorize/:owner/:applicationName" render={(props) => <LoginPage account={this.state.account} type={"saml"} mode={"signin"} {...props} onUpdateAccount={(account) => {this.onUpdateAccount(account)}} />}/>
|
||||||
<Route exact path="/cas/:owner/:casApplicationName/login" render={(props) => {return (<LoginPage type={"cas"} mode={"signup"} account={this.state.account} {...props} />)}} />
|
<Route exact path="/cas/:owner/:casApplicationName/logout" render={(props) => this.renderHomeIfLoggedIn(<CasLogout clearAccount={() => this.setState({account: null})} {...props} />)} />
|
||||||
<Route exact path="/callback" component={AuthCallback}/>
|
<Route exact path="/cas/:owner/:casApplicationName/login" render={(props) => {return (<LoginPage type={"cas"} mode={"signup"} account={this.state.account} {...props} />)}} />
|
||||||
<Route exact path="/callback/saml" component={SamlCallback}/>
|
<Route exact path="/callback" component={AuthCallback}/>
|
||||||
<Route exact path="/forget" render={(props) => this.renderHomeIfLoggedIn(<SelfForgetPage {...props} />)}/>
|
<Route exact path="/callback/saml" component={SamlCallback}/>
|
||||||
<Route exact path="/forget/:applicationName" render={(props) => this.renderHomeIfLoggedIn(<ForgetPage {...props} />)}/>
|
<Route exact path="/forget" render={(props) => this.renderHomeIfLoggedIn(<SelfForgetPage {...props} />)}/>
|
||||||
<Route exact path="/prompt" render={(props) => this.renderLoginIfNotLoggedIn(<PromptPage account={this.state.account} {...props} />)}/>
|
<Route exact path="/forget/:applicationName" render={(props) => this.renderHomeIfLoggedIn(<ForgetPage {...props} />)}/>
|
||||||
<Route exact path="/prompt/:applicationName" render={(props) => this.renderLoginIfNotLoggedIn(<PromptPage account={this.state.account} onUpdateAccount={(account) => {this.onUpdateAccount(account)}} {...props} />)}/>
|
<Route exact path="/prompt" render={(props) => this.renderLoginIfNotLoggedIn(<PromptPage account={this.state.account} {...props} />)}/>
|
||||||
<Route path="" render={() => <Result status="404" title="404 NOT FOUND" subTitle={i18next.t("general:Sorry, the page you visited does not exist.")}
|
<Route exact path="/prompt/:applicationName" render={(props) => this.renderLoginIfNotLoggedIn(<PromptPage account={this.state.account} onUpdateAccount={(account) => {this.onUpdateAccount(account)}} {...props} />)}/>
|
||||||
extra={<a href="/"><Button type="primary">{i18next.t("general:Back Home")}</Button></a>}/>} />
|
<Route path="" render={() => <Result status="404" title="404 NOT FOUND" subTitle={i18next.t("general:Sorry, the page you visited does not exist.")}
|
||||||
</Switch>
|
extra={<a href="/"><Button type="primary">{i18next.t("general:Back Home")}</Button></a>}/>} />
|
||||||
|
</Switch>
|
||||||
|
{
|
||||||
|
this.renderFooter()
|
||||||
|
}
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,6 +474,16 @@ class ApplicationEditPage extends React.Component {
|
|||||||
</Select>
|
</Select>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
<Row style={{marginTop: '20px'}} >
|
||||||
|
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 19 : 2}>
|
||||||
|
{Setting.getLabel(i18next.t("application:Enable SAML compress"), i18next.t("application:Enable SAML compress - Tooltip"))} :
|
||||||
|
</Col>
|
||||||
|
<Col span={1} >
|
||||||
|
<Switch checked={this.state.application.enableSamlCompress} onChange={checked => {
|
||||||
|
this.updateApplicationField('enableSamlCompress', checked);
|
||||||
|
}} />
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
<Row style={{marginTop: '20px'}} >
|
<Row style={{marginTop: '20px'}} >
|
||||||
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
{Setting.getLabel(i18next.t("application:SAML metadata"), i18next.t("application:SAML metadata - Tooltip"))} :
|
{Setting.getLabel(i18next.t("application:SAML metadata"), i18next.t("application:SAML metadata - Tooltip"))} :
|
||||||
@ -484,6 +494,14 @@ class ApplicationEditPage extends React.Component {
|
|||||||
options={{mode: 'xml', theme: 'default'}}
|
options={{mode: 'xml', theme: 'default'}}
|
||||||
onBeforeChange={(editor, data, value) => {}}
|
onBeforeChange={(editor, data, value) => {}}
|
||||||
/>
|
/>
|
||||||
|
<br/>
|
||||||
|
<Button style={{marginBottom: "10px"}} type="primary" shape="round" icon={<CopyOutlined />} onClick={() => {
|
||||||
|
copy(`${window.location.origin}/api/saml/metadata?application=admin/${encodeURIComponent(this.state.applicationName)}`);
|
||||||
|
Setting.showMessage("success", i18next.t("application:SAML metadata URL copied to clipboard successfully"));
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{i18next.t("application:Copy SAML metadata URL")}
|
||||||
|
</Button>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Row style={{marginTop: '20px'}} >
|
<Row style={{marginTop: '20px'}} >
|
||||||
|
@ -35,6 +35,7 @@ class ApplicationListPage extends BaseListPage {
|
|||||||
enableSignUp: true,
|
enableSignUp: true,
|
||||||
enableSigninSession: false,
|
enableSigninSession: false,
|
||||||
enableCodeSignin: false,
|
enableCodeSignin: false,
|
||||||
|
enableSamlCompress: false,
|
||||||
providers: [
|
providers: [
|
||||||
{name: "provider_captcha_default", canSignUp: false, canSignIn: false, canUnlink: false, prompted: false, alertType: "None"},
|
{name: "provider_captcha_default", canSignUp: false, canSignIn: false, canUnlink: false, prompted: false, alertType: "None"},
|
||||||
],
|
],
|
||||||
|
@ -93,7 +93,7 @@ class PermissionListPage extends BaseListPage {
|
|||||||
...this.getColumnSearchProps('name'),
|
...this.getColumnSearchProps('name'),
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<Link to={`/permissions/${text}`}>
|
<Link to={`/permissions/${record.owner}/${text}`}>
|
||||||
{text}
|
{text}
|
||||||
</Link>
|
</Link>
|
||||||
)
|
)
|
||||||
|
@ -81,7 +81,11 @@ class ProviderEditPage extends React.Component {
|
|||||||
return Setting.getLabel(i18next.t("provider:Client ID"), i18next.t("provider:Client ID - Tooltip"));
|
return Setting.getLabel(i18next.t("provider:Client ID"), i18next.t("provider:Client ID - Tooltip"));
|
||||||
}
|
}
|
||||||
case "Captcha":
|
case "Captcha":
|
||||||
return Setting.getLabel(i18next.t("provider:Site key"), i18next.t("provider:Site key - Tooltip"));
|
if (this.state.provider.type === "Aliyun Captcha") {
|
||||||
|
return Setting.getLabel(i18next.t("provider:Access key"), i18next.t("provider:Access key - Tooltip"));
|
||||||
|
} else {
|
||||||
|
return Setting.getLabel(i18next.t("provider:Site key"), i18next.t("provider:Site key - Tooltip"));
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return Setting.getLabel(i18next.t("provider:Client ID"), i18next.t("provider:Client ID - Tooltip"));
|
return Setting.getLabel(i18next.t("provider:Client ID"), i18next.t("provider:Client ID - Tooltip"));
|
||||||
}
|
}
|
||||||
@ -100,7 +104,11 @@ class ProviderEditPage extends React.Component {
|
|||||||
return Setting.getLabel(i18next.t("provider:Client secret"), i18next.t("provider:Client secret - Tooltip"));
|
return Setting.getLabel(i18next.t("provider:Client secret"), i18next.t("provider:Client secret - Tooltip"));
|
||||||
}
|
}
|
||||||
case "Captcha":
|
case "Captcha":
|
||||||
return Setting.getLabel(i18next.t("provider:Secret key"), i18next.t("provider:Secret key - Tooltip"));
|
if (this.state.provider.type === "Aliyun Captcha") {
|
||||||
|
return Setting.getLabel(i18next.t("provider:Secret access key"), i18next.t("provider:SecretAccessKey - Tooltip"));
|
||||||
|
} else {
|
||||||
|
return Setting.getLabel(i18next.t("provider:Secret key"), i18next.t("provider:Secret key - Tooltip"));
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return Setting.getLabel(i18next.t("provider:Client secret"), i18next.t("provider:Client secret - Tooltip"));
|
return Setting.getLabel(i18next.t("provider:Client secret"), i18next.t("provider:Client secret - Tooltip"));
|
||||||
}
|
}
|
||||||
@ -242,7 +250,7 @@ class ProviderEditPage extends React.Component {
|
|||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
{
|
{
|
||||||
this.state.provider.type !== "WeCom" && this.state.provider.type !== "Infoflow" ? null : (
|
this.state.provider.type !== "WeCom" && this.state.provider.type !== "Infoflow" && this.state.provider.type !== "Aliyun Captcha" ? null : (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Row style={{marginTop: '20px'}} >
|
<Row style={{marginTop: '20px'}} >
|
||||||
<Col style={{marginTop: '5px'}} span={2}>
|
<Col style={{marginTop: '5px'}} span={2}>
|
||||||
@ -378,11 +386,13 @@ class ProviderEditPage extends React.Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
this.state.provider.type !== "WeChat" ? null : (
|
this.state.provider.type !== "WeChat" && this.state.provider.type !== "Aliyun Captcha" ? null : (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Row style={{marginTop: '20px'}} >
|
<Row style={{marginTop: '20px'}} >
|
||||||
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
{Setting.getLabel(i18next.t("provider:Client ID 2"), i18next.t("provider:Client ID 2 - Tooltip"))}
|
{this.state.provider.type === "Aliyun Captcha"
|
||||||
|
? Setting.getLabel(i18next.t("provider:Scene"), i18next.t("provider:Scene - Tooltip"))
|
||||||
|
: Setting.getLabel(i18next.t("provider:Client ID 2"), i18next.t("provider:Client ID 2 - Tooltip"))}
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={22} >
|
<Col span={22} >
|
||||||
<Input value={this.state.provider.clientId2} onChange={e => {
|
<Input value={this.state.provider.clientId2} onChange={e => {
|
||||||
@ -392,7 +402,9 @@ class ProviderEditPage extends React.Component {
|
|||||||
</Row>
|
</Row>
|
||||||
<Row style={{marginTop: '20px'}} >
|
<Row style={{marginTop: '20px'}} >
|
||||||
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
{Setting.getLabel(i18next.t("provider:Client secret 2"), i18next.t("provider:Client secret 2 - Tooltip"))}
|
{this.state.provider.type === "Aliyun Captcha"
|
||||||
|
? Setting.getLabel(i18next.t("provider:App key"), i18next.t("provider:App key - Tooltip"))
|
||||||
|
: Setting.getLabel(i18next.t("provider:Client secret 2"), i18next.t("provider:Client secret 2 - Tooltip"))}
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={22} >
|
<Col span={22} >
|
||||||
<Input value={this.state.provider.clientSecret2} onChange={e => {
|
<Input value={this.state.provider.clientSecret2} onChange={e => {
|
||||||
@ -686,10 +698,13 @@ class ProviderEditPage extends React.Component {
|
|||||||
providerName={this.state.providerName}
|
providerName={this.state.providerName}
|
||||||
clientSecret={this.state.provider.clientSecret}
|
clientSecret={this.state.provider.clientSecret}
|
||||||
captchaType={this.state.provider.type}
|
captchaType={this.state.provider.type}
|
||||||
|
subType={this.state.provider.subType}
|
||||||
owner={this.state.provider.owner}
|
owner={this.state.provider.owner}
|
||||||
clientId={this.state.provider.clientId}
|
clientId={this.state.provider.clientId}
|
||||||
name={this.state.provider.name}
|
name={this.state.provider.name}
|
||||||
providerUrl={this.state.provider.providerUrl}
|
providerUrl={this.state.provider.providerUrl}
|
||||||
|
clientId2={this.state.provider.clientId2}
|
||||||
|
clientSecret2={this.state.provider.clientSecret2}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -118,6 +118,10 @@ export const OtherProviderInfo = {
|
|||||||
"hCaptcha": {
|
"hCaptcha": {
|
||||||
logo: `${StaticBaseUrl}/img/social_hcaptcha.png`,
|
logo: `${StaticBaseUrl}/img/social_hcaptcha.png`,
|
||||||
url: "https://www.hcaptcha.com",
|
url: "https://www.hcaptcha.com",
|
||||||
|
},
|
||||||
|
"Aliyun Captcha": {
|
||||||
|
logo: `${StaticBaseUrl}/img/social_aliyun.png`,
|
||||||
|
url: "https://help.aliyun.com/product/28308.html",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -614,6 +618,7 @@ export function getProviderTypeOptions(category) {
|
|||||||
{id: 'Default', name: 'Default'},
|
{id: 'Default', name: 'Default'},
|
||||||
{id: 'reCAPTCHA', name: 'reCAPTCHA'},
|
{id: 'reCAPTCHA', name: 'reCAPTCHA'},
|
||||||
{id: 'hCaptcha', name: 'hCaptcha'},
|
{id: 'hCaptcha', name: 'hCaptcha'},
|
||||||
|
{id: 'Aliyun Captcha', name: 'Aliyun Captcha'},
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
@ -628,6 +633,11 @@ export function getProviderSubTypeOptions(type) {
|
|||||||
{id: 'Third-party', name: 'Third-party'},
|
{id: 'Third-party', name: 'Third-party'},
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
} else if (type === "Aliyun Captcha") {
|
||||||
|
return [
|
||||||
|
{id: 'nc', name: 'Sliding Validation'},
|
||||||
|
{id: 'ic', name: 'Intelligent Validation'},
|
||||||
|
];
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -97,8 +97,8 @@ const authInfo = {
|
|||||||
endpoint: "https://appleid.apple.com/auth/authorize",
|
endpoint: "https://appleid.apple.com/auth/authorize",
|
||||||
},
|
},
|
||||||
AzureAD: {
|
AzureAD: {
|
||||||
scope: "user_impersonation",
|
scope: "user.read",
|
||||||
endpoint: "https://login.microsoftonline.com/common/oauth2/authorize",
|
endpoint: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
|
||||||
},
|
},
|
||||||
Slack: {
|
Slack: {
|
||||||
scope: "users:read",
|
scope: "users:read",
|
||||||
@ -236,7 +236,7 @@ export function getAuthUrl(application, provider, method) {
|
|||||||
} else if (provider.type === "Apple") {
|
} else if (provider.type === "Apple") {
|
||||||
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}&response_mode=form_post`;
|
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}&response_mode=form_post`;
|
||||||
} else if (provider.type === "AzureAD") {
|
} else if (provider.type === "AzureAD") {
|
||||||
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}&resource=https://graph.windows.net/`;
|
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}`;
|
||||||
} else if (provider.type === "Slack") {
|
} else if (provider.type === "Slack") {
|
||||||
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}`;
|
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}`;
|
||||||
} else if (provider.type === "Steam") {
|
} else if (provider.type === "Steam") {
|
||||||
|
@ -20,18 +20,27 @@ import * as ProviderBackend from "../backend/ProviderBackend";
|
|||||||
import { SafetyOutlined } from "@ant-design/icons";
|
import { SafetyOutlined } from "@ant-design/icons";
|
||||||
import { CaptchaWidget } from "./CaptchaWidget";
|
import { CaptchaWidget } from "./CaptchaWidget";
|
||||||
|
|
||||||
export const CaptchaPreview = ({ provider, providerName, clientSecret, captchaType, owner, clientId, name, providerUrl }) => {
|
export const CaptchaPreview = ({
|
||||||
|
provider,
|
||||||
|
providerName,
|
||||||
|
clientSecret,
|
||||||
|
captchaType,
|
||||||
|
subType,
|
||||||
|
owner,
|
||||||
|
clientId,
|
||||||
|
name,
|
||||||
|
providerUrl,
|
||||||
|
clientId2,
|
||||||
|
clientSecret2,
|
||||||
|
}) => {
|
||||||
const [visible, setVisible] = React.useState(false);
|
const [visible, setVisible] = React.useState(false);
|
||||||
const [captchaImg, setCaptchaImg] = React.useState("");
|
const [captchaImg, setCaptchaImg] = React.useState("");
|
||||||
const [captchaToken, setCaptchaToken] = React.useState("");
|
const [captchaToken, setCaptchaToken] = React.useState("");
|
||||||
const [secret, setSecret] = React.useState(clientSecret);
|
const [secret, setSecret] = React.useState(clientSecret);
|
||||||
|
const [secret2, setSecret2] = React.useState(clientSecret2);
|
||||||
|
|
||||||
const handleOk = () => {
|
const handleOk = () => {
|
||||||
UserBackend.verifyCaptcha(
|
UserBackend.verifyCaptcha(captchaType, captchaToken, secret).then(() => {
|
||||||
captchaType,
|
|
||||||
captchaToken,
|
|
||||||
secret
|
|
||||||
).then(() => {
|
|
||||||
setCaptchaToken("");
|
setCaptchaToken("");
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
});
|
});
|
||||||
@ -48,9 +57,10 @@ export const CaptchaPreview = ({ provider, providerName, clientSecret, captchaTy
|
|||||||
setCaptchaImg(res.captchaImage);
|
setCaptchaImg(res.captchaImage);
|
||||||
} else {
|
} else {
|
||||||
setSecret(res.clientSecret);
|
setSecret(res.clientSecret);
|
||||||
|
setSecret2(res.clientSecret2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
const clickPreview = () => {
|
const clickPreview = () => {
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
@ -100,24 +110,50 @@ export const CaptchaPreview = ({ provider, providerName, clientSecret, captchaTy
|
|||||||
setCaptchaToken(token);
|
setCaptchaToken(token);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const renderCheck = () => {
|
const renderCheck = () => {
|
||||||
if (captchaType === "Default") {
|
if (captchaType === "Default") {
|
||||||
return renderDefaultCaptcha();
|
return renderDefaultCaptcha();
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<CaptchaWidget
|
<Col>
|
||||||
captchaType={captchaType}
|
<Row>
|
||||||
siteKey={clientId}
|
<CaptchaWidget
|
||||||
onChange={onSubmit}
|
captchaType={captchaType}
|
||||||
/>
|
subType={subType}
|
||||||
|
siteKey={clientId}
|
||||||
|
clientSecret={secret}
|
||||||
|
onChange={onSubmit}
|
||||||
|
clientId2={clientId2}
|
||||||
|
clientSecret2={secret2}
|
||||||
|
/>
|
||||||
|
</Row>
|
||||||
|
</Col>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getButtonDisabled = () => {
|
||||||
|
if (captchaType !== "Default") {
|
||||||
|
if (!clientId || !clientSecret) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (captchaType === "Aliyun Captcha") {
|
||||||
|
if (!subType || !clientId2 || !clientSecret2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Button style={{ fontSize: 14 }} type={"primary"} onClick={clickPreview} disabled={captchaType !== "Default" && (!clientId || !clientSecret)}>
|
<Button
|
||||||
|
style={{ fontSize: 14 }}
|
||||||
|
type={"primary"}
|
||||||
|
onClick={clickPreview}
|
||||||
|
disabled={getButtonDisabled()}
|
||||||
|
>
|
||||||
{i18next.t("general:Preview")}
|
{i18next.t("general:Preview")}
|
||||||
</Button>
|
</Button>
|
||||||
<Modal
|
<Modal
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
|
|
||||||
export const CaptchaWidget = ({ captchaType, siteKey, onChange }) => {
|
export const CaptchaWidget = ({ captchaType, subType, siteKey, clientSecret, onChange, clientId2, clientSecret2 }) => {
|
||||||
const loadScript = (src) => {
|
const loadScript = (src) => {
|
||||||
var tag = document.createElement("script");
|
var tag = document.createElement("script");
|
||||||
tag.async = false;
|
tag.async = false;
|
||||||
@ -53,11 +53,34 @@ export const CaptchaWidget = ({ captchaType, siteKey, onChange }) => {
|
|||||||
}
|
}
|
||||||
}, 300);
|
}, 300);
|
||||||
break;
|
break;
|
||||||
|
case "Aliyun Captcha":
|
||||||
|
const AWSCTimer = setInterval(() => {
|
||||||
|
if (!window.AWSC) {
|
||||||
|
loadScript("https://g.alicdn.com/AWSC/AWSC/awsc.js");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window.AWSC) {
|
||||||
|
if (clientSecret2 && clientSecret2 !== "***") {
|
||||||
|
window.AWSC.use(subType, function (state, module) {
|
||||||
|
module.init({
|
||||||
|
appkey: clientSecret2,
|
||||||
|
scene: clientId2,
|
||||||
|
renderTo: "captcha",
|
||||||
|
success: function (data) {
|
||||||
|
onChange(`SessionId=${data.sessionId}&AccessKeyId=${siteKey}&Scene=${clientId2}&AppKey=${clientSecret2}&Token=${data.token}&Sig=${data.sig}&RemoteIp=192.168.0.1`);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
clearInterval(AWSCTimer);
|
||||||
|
}
|
||||||
|
}, 300);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [captchaType, siteKey]);
|
}, [captchaType, subType, siteKey, clientSecret, clientId2, clientSecret2]);
|
||||||
|
|
||||||
return <div id="captcha"></div>;
|
return <div id="captcha"></div>;
|
||||||
};
|
};
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
import {Button, Col, Input, Modal, Row} from "antd";
|
import {Button, Col, Input, Modal, Row} from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import * as Setting from "../Setting";
|
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import * as UserBackend from "../backend/UserBackend";
|
import * as UserBackend from "../backend/UserBackend";
|
||||||
import {SafetyOutlined} from "@ant-design/icons";
|
import {SafetyOutlined} from "@ant-design/icons";
|
||||||
@ -34,6 +33,9 @@ export const CountDownInput = (props) => {
|
|||||||
const [buttonLoading, setButtonLoading] = React.useState(false);
|
const [buttonLoading, setButtonLoading] = React.useState(false);
|
||||||
const [buttonDisabled, setButtonDisabled] = React.useState(true);
|
const [buttonDisabled, setButtonDisabled] = React.useState(true);
|
||||||
const [clientId, setClientId] = React.useState("");
|
const [clientId, setClientId] = React.useState("");
|
||||||
|
const [subType, setSubType] = React.useState("");
|
||||||
|
const [clientId2, setClientId2] = React.useState("");
|
||||||
|
const [clientSecret2, setClientSecret2] = React.useState("");
|
||||||
|
|
||||||
const handleCountDown = (leftTime = 60) => {
|
const handleCountDown = (leftTime = 60) => {
|
||||||
let leftTimeSecond = leftTime
|
let leftTimeSecond = leftTime
|
||||||
@ -79,13 +81,14 @@ export const CountDownInput = (props) => {
|
|||||||
setCaptchaImg(res.captchaImage);
|
setCaptchaImg(res.captchaImage);
|
||||||
setCheckType("Default");
|
setCheckType("Default");
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
} else if (res.type === "reCAPTCHA" || res.type === "hCaptcha") {
|
} else {
|
||||||
setCheckType(res.type);
|
setCheckType(res.type);
|
||||||
setClientId(res.clientId);
|
setClientId(res.clientId);
|
||||||
setCheckId(res.clientSecret);
|
setCheckId(res.clientSecret);
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
} else {
|
setSubType(res.subType);
|
||||||
Setting.showMessage("error", i18next.t("signup:Unknown Check Type"));
|
setClientId2(res.clientId2);
|
||||||
|
setClientSecret2(res.clientSecret2);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -123,8 +126,12 @@ export const CountDownInput = (props) => {
|
|||||||
return (
|
return (
|
||||||
<CaptchaWidget
|
<CaptchaWidget
|
||||||
captchaType={checkType}
|
captchaType={checkType}
|
||||||
|
subType={subType}
|
||||||
siteKey={clientId}
|
siteKey={clientId}
|
||||||
|
clientSecret={checkId}
|
||||||
onChange={onSubmit}
|
onChange={onSubmit}
|
||||||
|
clientId2={clientId2}
|
||||||
|
clientSecret2={clientSecret2}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,13 @@
|
|||||||
"Sign Up": "Registrieren"
|
"Sign Up": "Registrieren"
|
||||||
},
|
},
|
||||||
"application": {
|
"application": {
|
||||||
|
"Copy SAML metadata URL": "Copy SAML metadata URL",
|
||||||
"Copy prompt page URL": "Copy prompt page URL",
|
"Copy prompt page URL": "Copy prompt page URL",
|
||||||
"Copy signin page URL": "Copy signin page URL",
|
"Copy signin page URL": "Copy signin page URL",
|
||||||
"Copy signup page URL": "Copy signup page URL",
|
"Copy signup page URL": "Copy signup page URL",
|
||||||
"Edit Application": "Anwendung bearbeiten",
|
"Edit Application": "Anwendung bearbeiten",
|
||||||
|
"Enable SAML compress": "Enable SAML compress",
|
||||||
|
"Enable SAML compress - Tooltip": "Enable SAML compress - Tooltip",
|
||||||
"Enable code signin": "Code-Anmeldung aktivieren",
|
"Enable code signin": "Code-Anmeldung aktivieren",
|
||||||
"Enable code signin - Tooltip": "Aktiviere Codeanmeldung - Tooltip",
|
"Enable code signin - Tooltip": "Aktiviere Codeanmeldung - Tooltip",
|
||||||
"Enable signin session - Tooltip": "Aktiviere Anmeldesession - Tooltip",
|
"Enable signin session - Tooltip": "Aktiviere Anmeldesession - Tooltip",
|
||||||
@ -30,6 +33,7 @@
|
|||||||
"Refresh token expire - Tooltip": "Aktualisierungs-Token läuft ab - Tooltip",
|
"Refresh token expire - Tooltip": "Aktualisierungs-Token läuft ab - Tooltip",
|
||||||
"SAML metadata": "SAML metadata",
|
"SAML metadata": "SAML metadata",
|
||||||
"SAML metadata - Tooltip": "SAML metadata - Tooltip",
|
"SAML metadata - Tooltip": "SAML metadata - Tooltip",
|
||||||
|
"SAML metadata URL copied to clipboard successfully": "SAML metadata URL copied to clipboard successfully",
|
||||||
"Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser",
|
"Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser",
|
||||||
"Signin session": "Anmeldesitzung",
|
"Signin session": "Anmeldesitzung",
|
||||||
"Signup items": "Artikel registrieren",
|
"Signup items": "Artikel registrieren",
|
||||||
@ -442,6 +446,8 @@
|
|||||||
"SP ACS URL": "SP-ACS-URL",
|
"SP ACS URL": "SP-ACS-URL",
|
||||||
"SP ACS URL - Tooltip": "SP ACS URL - Tooltip",
|
"SP ACS URL - Tooltip": "SP ACS URL - Tooltip",
|
||||||
"SP Entity ID": "SP Entity ID",
|
"SP Entity ID": "SP Entity ID",
|
||||||
|
"Scene": "Scene",
|
||||||
|
"Scene - Tooltip": "Scene - Tooltip",
|
||||||
"Scope": "Scope",
|
"Scope": "Scope",
|
||||||
"Scope - Tooltip": "Scope - Tooltip",
|
"Scope - Tooltip": "Scope - Tooltip",
|
||||||
"Secret access key": "Geheimer Zugangsschlüssel",
|
"Secret access key": "Geheimer Zugangsschlüssel",
|
||||||
@ -533,7 +539,6 @@
|
|||||||
"The input is not invoice title!": "The input is not invoice title!",
|
"The input is not invoice title!": "The input is not invoice title!",
|
||||||
"The input is not valid Email!": "Die Eingabe ist ungültig!",
|
"The input is not valid Email!": "Die Eingabe ist ungültig!",
|
||||||
"The input is not valid Phone!": "Die Eingabe ist nicht gültig!",
|
"The input is not valid Phone!": "Die Eingabe ist nicht gültig!",
|
||||||
"Unknown Check Type": "Unbekannter Schecktyp",
|
|
||||||
"Username": "Benutzername",
|
"Username": "Benutzername",
|
||||||
"Username - Tooltip": "Benutzername - Tooltip",
|
"Username - Tooltip": "Benutzername - Tooltip",
|
||||||
"Your account has been created!": "Ihr Konto wurde erstellt!",
|
"Your account has been created!": "Ihr Konto wurde erstellt!",
|
||||||
|
@ -6,10 +6,13 @@
|
|||||||
"Sign Up": "Sign Up"
|
"Sign Up": "Sign Up"
|
||||||
},
|
},
|
||||||
"application": {
|
"application": {
|
||||||
|
"Copy SAML metadata URL": "Copy SAML metadata URL",
|
||||||
"Copy prompt page URL": "Copy prompt page URL",
|
"Copy prompt page URL": "Copy prompt page URL",
|
||||||
"Copy signin page URL": "Copy signin page URL",
|
"Copy signin page URL": "Copy signin page URL",
|
||||||
"Copy signup page URL": "Copy signup page URL",
|
"Copy signup page URL": "Copy signup page URL",
|
||||||
"Edit Application": "Edit Application",
|
"Edit Application": "Edit Application",
|
||||||
|
"Enable SAML compress": "Enable SAML compress",
|
||||||
|
"Enable SAML compress - Tooltip": "Enable SAML compress - Tooltip",
|
||||||
"Enable code signin": "Enable code signin",
|
"Enable code signin": "Enable code signin",
|
||||||
"Enable code signin - Tooltip": "Enable code signin - Tooltip",
|
"Enable code signin - Tooltip": "Enable code signin - Tooltip",
|
||||||
"Enable signin session - Tooltip": "Enable signin session - Tooltip",
|
"Enable signin session - Tooltip": "Enable signin session - Tooltip",
|
||||||
@ -30,6 +33,7 @@
|
|||||||
"Refresh token expire - Tooltip": "Refresh token expire - Tooltip",
|
"Refresh token expire - Tooltip": "Refresh token expire - Tooltip",
|
||||||
"SAML metadata": "SAML metadata",
|
"SAML metadata": "SAML metadata",
|
||||||
"SAML metadata - Tooltip": "SAML metadata - Tooltip",
|
"SAML metadata - Tooltip": "SAML metadata - Tooltip",
|
||||||
|
"SAML metadata URL copied to clipboard successfully": "SAML metadata URL copied to clipboard successfully",
|
||||||
"Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser",
|
"Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser",
|
||||||
"Signin session": "Signin session",
|
"Signin session": "Signin session",
|
||||||
"Signup items": "Signup items",
|
"Signup items": "Signup items",
|
||||||
@ -407,9 +411,9 @@
|
|||||||
"Domain": "Domain",
|
"Domain": "Domain",
|
||||||
"Domain - Tooltip": "Domain - Tooltip",
|
"Domain - Tooltip": "Domain - Tooltip",
|
||||||
"Edit Provider": "Edit Provider",
|
"Edit Provider": "Edit Provider",
|
||||||
"Email Content": "Email content",
|
"Email Content": "Email Content",
|
||||||
"Email Content - Tooltip": "Email Content - Tooltip",
|
"Email Content - Tooltip": "Email Content - Tooltip",
|
||||||
"Email Title": "Email title",
|
"Email Title": "Email Title",
|
||||||
"Email Title - Tooltip": "Email Title - Tooltip",
|
"Email Title - Tooltip": "Email Title - Tooltip",
|
||||||
"Endpoint": "Endpoint",
|
"Endpoint": "Endpoint",
|
||||||
"Endpoint (Intranet)": "Endpoint (Intranet)",
|
"Endpoint (Intranet)": "Endpoint (Intranet)",
|
||||||
@ -442,6 +446,8 @@
|
|||||||
"SP ACS URL": "SP ACS URL",
|
"SP ACS URL": "SP ACS URL",
|
||||||
"SP ACS URL - Tooltip": "SP ACS URL - Tooltip",
|
"SP ACS URL - Tooltip": "SP ACS URL - Tooltip",
|
||||||
"SP Entity ID": "SP Entity ID",
|
"SP Entity ID": "SP Entity ID",
|
||||||
|
"Scene": "Scene",
|
||||||
|
"Scene - Tooltip": "Scene - Tooltip",
|
||||||
"Scope": "Scope",
|
"Scope": "Scope",
|
||||||
"Scope - Tooltip": "Scope - Tooltip",
|
"Scope - Tooltip": "Scope - Tooltip",
|
||||||
"Secret access key": "Secret access key",
|
"Secret access key": "Secret access key",
|
||||||
@ -467,9 +473,9 @@
|
|||||||
"Template Code - Tooltip": "Template Code - Tooltip",
|
"Template Code - Tooltip": "Template Code - Tooltip",
|
||||||
"Terms of Use": "Terms of Use",
|
"Terms of Use": "Terms of Use",
|
||||||
"Terms of Use - Tooltip": "Terms of Use - Tooltip",
|
"Terms of Use - Tooltip": "Terms of Use - Tooltip",
|
||||||
"Test Connection": "Test Smtp Connection",
|
"Test Connection": "Test Connection",
|
||||||
"Test Email": "Test email config",
|
"Test Email": "Test Email",
|
||||||
"Test Email - Tooltip": "Email Address",
|
"Test Email - Tooltip": "Test Email - Tooltip",
|
||||||
"Token URL": "Token URL",
|
"Token URL": "Token URL",
|
||||||
"Token URL - Tooltip": "Token URL - Tooltip",
|
"Token URL - Tooltip": "Token URL - Tooltip",
|
||||||
"Type": "Type",
|
"Type": "Type",
|
||||||
@ -533,7 +539,6 @@
|
|||||||
"The input is not invoice title!": "The input is not invoice title!",
|
"The input is not invoice title!": "The input is not invoice title!",
|
||||||
"The input is not valid Email!": "The input is not valid Email!",
|
"The input is not valid Email!": "The input is not valid Email!",
|
||||||
"The input is not valid Phone!": "The input is not valid Phone!",
|
"The input is not valid Phone!": "The input is not valid Phone!",
|
||||||
"Unknown Check Type": "Unknown Check Type",
|
|
||||||
"Username": "Username",
|
"Username": "Username",
|
||||||
"Username - Tooltip": "Username - Tooltip",
|
"Username - Tooltip": "Username - Tooltip",
|
||||||
"Your account has been created!": "Your account has been created!",
|
"Your account has been created!": "Your account has been created!",
|
||||||
|
@ -6,10 +6,13 @@
|
|||||||
"Sign Up": "S'inscrire"
|
"Sign Up": "S'inscrire"
|
||||||
},
|
},
|
||||||
"application": {
|
"application": {
|
||||||
|
"Copy SAML metadata URL": "Copy SAML metadata URL",
|
||||||
"Copy prompt page URL": "Copy prompt page URL",
|
"Copy prompt page URL": "Copy prompt page URL",
|
||||||
"Copy signin page URL": "Copy signin page URL",
|
"Copy signin page URL": "Copy signin page URL",
|
||||||
"Copy signup page URL": "Copy signup page URL",
|
"Copy signup page URL": "Copy signup page URL",
|
||||||
"Edit Application": "Modifier l'application",
|
"Edit Application": "Modifier l'application",
|
||||||
|
"Enable SAML compress": "Enable SAML compress",
|
||||||
|
"Enable SAML compress - Tooltip": "Enable SAML compress - Tooltip",
|
||||||
"Enable code signin": "Activer la connexion au code",
|
"Enable code signin": "Activer la connexion au code",
|
||||||
"Enable code signin - Tooltip": "Activer la connexion au code - infobulle",
|
"Enable code signin - Tooltip": "Activer la connexion au code - infobulle",
|
||||||
"Enable signin session - Tooltip": "Activer la session de connexion - infobulle",
|
"Enable signin session - Tooltip": "Activer la session de connexion - infobulle",
|
||||||
@ -30,6 +33,7 @@
|
|||||||
"Refresh token expire - Tooltip": "Expiration du jeton d'actualisation - infobulle",
|
"Refresh token expire - Tooltip": "Expiration du jeton d'actualisation - infobulle",
|
||||||
"SAML metadata": "SAML metadata",
|
"SAML metadata": "SAML metadata",
|
||||||
"SAML metadata - Tooltip": "SAML metadata - Tooltip",
|
"SAML metadata - Tooltip": "SAML metadata - Tooltip",
|
||||||
|
"SAML metadata URL copied to clipboard successfully": "SAML metadata URL copied to clipboard successfully",
|
||||||
"Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser",
|
"Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser",
|
||||||
"Signin session": "Connexion à la session",
|
"Signin session": "Connexion à la session",
|
||||||
"Signup items": "Inscrire des éléments",
|
"Signup items": "Inscrire des éléments",
|
||||||
@ -442,6 +446,8 @@
|
|||||||
"SP ACS URL": "URL du SP ACS",
|
"SP ACS URL": "URL du SP ACS",
|
||||||
"SP ACS URL - Tooltip": "URL SP ACS - infobulle",
|
"SP ACS URL - Tooltip": "URL SP ACS - infobulle",
|
||||||
"SP Entity ID": "ID de l'entité SP",
|
"SP Entity ID": "ID de l'entité SP",
|
||||||
|
"Scene": "Scene",
|
||||||
|
"Scene - Tooltip": "Scene - Tooltip",
|
||||||
"Scope": "Scope",
|
"Scope": "Scope",
|
||||||
"Scope - Tooltip": "Scope - Tooltip",
|
"Scope - Tooltip": "Scope - Tooltip",
|
||||||
"Secret access key": "Clé d'accès secrète",
|
"Secret access key": "Clé d'accès secrète",
|
||||||
@ -533,7 +539,6 @@
|
|||||||
"The input is not invoice title!": "The input is not invoice title!",
|
"The input is not invoice title!": "The input is not invoice title!",
|
||||||
"The input is not valid Email!": "L'entrée n'est pas un email valide !",
|
"The input is not valid Email!": "L'entrée n'est pas un email valide !",
|
||||||
"The input is not valid Phone!": "L'entrée n'est pas un téléphone valide !",
|
"The input is not valid Phone!": "L'entrée n'est pas un téléphone valide !",
|
||||||
"Unknown Check Type": "Type de vérification inconnu",
|
|
||||||
"Username": "Nom d'utilisateur",
|
"Username": "Nom d'utilisateur",
|
||||||
"Username - Tooltip": "Nom d'utilisateur - Info-bulle",
|
"Username - Tooltip": "Nom d'utilisateur - Info-bulle",
|
||||||
"Your account has been created!": "Votre compte a été créé !",
|
"Your account has been created!": "Votre compte a été créé !",
|
||||||
|
@ -6,10 +6,13 @@
|
|||||||
"Sign Up": "新規登録"
|
"Sign Up": "新規登録"
|
||||||
},
|
},
|
||||||
"application": {
|
"application": {
|
||||||
|
"Copy SAML metadata URL": "Copy SAML metadata URL",
|
||||||
"Copy prompt page URL": "Copy prompt page URL",
|
"Copy prompt page URL": "Copy prompt page URL",
|
||||||
"Copy signin page URL": "Copy signin page URL",
|
"Copy signin page URL": "Copy signin page URL",
|
||||||
"Copy signup page URL": "Copy signup page URL",
|
"Copy signup page URL": "Copy signup page URL",
|
||||||
"Edit Application": "アプリケーションを編集",
|
"Edit Application": "アプリケーションを編集",
|
||||||
|
"Enable SAML compress": "Enable SAML compress",
|
||||||
|
"Enable SAML compress - Tooltip": "Enable SAML compress - Tooltip",
|
||||||
"Enable code signin": "コードサインインを有効にする",
|
"Enable code signin": "コードサインインを有効にする",
|
||||||
"Enable code signin - Tooltip": "Enable code signin - Tooltip",
|
"Enable code signin - Tooltip": "Enable code signin - Tooltip",
|
||||||
"Enable signin session - Tooltip": "Enable signin session - Tooltip",
|
"Enable signin session - Tooltip": "Enable signin session - Tooltip",
|
||||||
@ -30,6 +33,7 @@
|
|||||||
"Refresh token expire - Tooltip": "トークンの有効期限を更新する - ツールチップ",
|
"Refresh token expire - Tooltip": "トークンの有効期限を更新する - ツールチップ",
|
||||||
"SAML metadata": "SAML metadata",
|
"SAML metadata": "SAML metadata",
|
||||||
"SAML metadata - Tooltip": "SAML metadata - Tooltip",
|
"SAML metadata - Tooltip": "SAML metadata - Tooltip",
|
||||||
|
"SAML metadata URL copied to clipboard successfully": "SAML metadata URL copied to clipboard successfully",
|
||||||
"Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser",
|
"Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser",
|
||||||
"Signin session": "サインインセッション",
|
"Signin session": "サインインセッション",
|
||||||
"Signup items": "アイテムの登録",
|
"Signup items": "アイテムの登録",
|
||||||
@ -442,6 +446,8 @@
|
|||||||
"SP ACS URL": "SP ACS URL",
|
"SP ACS URL": "SP ACS URL",
|
||||||
"SP ACS URL - Tooltip": "SP ACS URL - ツールチップ",
|
"SP ACS URL - Tooltip": "SP ACS URL - ツールチップ",
|
||||||
"SP Entity ID": "SP ID",
|
"SP Entity ID": "SP ID",
|
||||||
|
"Scene": "Scene",
|
||||||
|
"Scene - Tooltip": "Scene - Tooltip",
|
||||||
"Scope": "Scope",
|
"Scope": "Scope",
|
||||||
"Scope - Tooltip": "Scope - Tooltip",
|
"Scope - Tooltip": "Scope - Tooltip",
|
||||||
"Secret access key": "シークレットアクセスキー",
|
"Secret access key": "シークレットアクセスキー",
|
||||||
@ -533,7 +539,6 @@
|
|||||||
"The input is not invoice title!": "The input is not invoice title!",
|
"The input is not invoice title!": "The input is not invoice title!",
|
||||||
"The input is not valid Email!": "入力されたメールアドレスが無効です!",
|
"The input is not valid Email!": "入力されたメールアドレスが無効です!",
|
||||||
"The input is not valid Phone!": "入力された電話番号が正しくありません!",
|
"The input is not valid Phone!": "入力された電話番号が正しくありません!",
|
||||||
"Unknown Check Type": "不明なチェックタイプ",
|
|
||||||
"Username": "ユーザー名",
|
"Username": "ユーザー名",
|
||||||
"Username - Tooltip": "ユーザー名 - ツールチップ",
|
"Username - Tooltip": "ユーザー名 - ツールチップ",
|
||||||
"Your account has been created!": "あなたのアカウントが作成されました!",
|
"Your account has been created!": "あなたのアカウントが作成されました!",
|
||||||
|
@ -6,10 +6,13 @@
|
|||||||
"Sign Up": "Sign Up"
|
"Sign Up": "Sign Up"
|
||||||
},
|
},
|
||||||
"application": {
|
"application": {
|
||||||
|
"Copy SAML metadata URL": "Copy SAML metadata URL",
|
||||||
"Copy prompt page URL": "Copy prompt page URL",
|
"Copy prompt page URL": "Copy prompt page URL",
|
||||||
"Copy signin page URL": "Copy signin page URL",
|
"Copy signin page URL": "Copy signin page URL",
|
||||||
"Copy signup page URL": "Copy signup page URL",
|
"Copy signup page URL": "Copy signup page URL",
|
||||||
"Edit Application": "Edit Application",
|
"Edit Application": "Edit Application",
|
||||||
|
"Enable SAML compress": "Enable SAML compress",
|
||||||
|
"Enable SAML compress - Tooltip": "Enable SAML compress - Tooltip",
|
||||||
"Enable code signin": "Enable code signin",
|
"Enable code signin": "Enable code signin",
|
||||||
"Enable code signin - Tooltip": "Enable code signin - Tooltip",
|
"Enable code signin - Tooltip": "Enable code signin - Tooltip",
|
||||||
"Enable signin session - Tooltip": "Enable signin session - Tooltip",
|
"Enable signin session - Tooltip": "Enable signin session - Tooltip",
|
||||||
@ -30,6 +33,7 @@
|
|||||||
"Refresh token expire - Tooltip": "Refresh token expire - Tooltip",
|
"Refresh token expire - Tooltip": "Refresh token expire - Tooltip",
|
||||||
"SAML metadata": "SAML metadata",
|
"SAML metadata": "SAML metadata",
|
||||||
"SAML metadata - Tooltip": "SAML metadata - Tooltip",
|
"SAML metadata - Tooltip": "SAML metadata - Tooltip",
|
||||||
|
"SAML metadata URL copied to clipboard successfully": "SAML metadata URL copied to clipboard successfully",
|
||||||
"Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser",
|
"Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser",
|
||||||
"Signin session": "Signin session",
|
"Signin session": "Signin session",
|
||||||
"Signup items": "Signup items",
|
"Signup items": "Signup items",
|
||||||
@ -442,6 +446,8 @@
|
|||||||
"SP ACS URL": "SP ACS URL",
|
"SP ACS URL": "SP ACS URL",
|
||||||
"SP ACS URL - Tooltip": "SP ACS URL - Tooltip",
|
"SP ACS URL - Tooltip": "SP ACS URL - Tooltip",
|
||||||
"SP Entity ID": "SP Entity ID",
|
"SP Entity ID": "SP Entity ID",
|
||||||
|
"Scene": "Scene",
|
||||||
|
"Scene - Tooltip": "Scene - Tooltip",
|
||||||
"Scope": "Scope",
|
"Scope": "Scope",
|
||||||
"Scope - Tooltip": "Scope - Tooltip",
|
"Scope - Tooltip": "Scope - Tooltip",
|
||||||
"Secret access key": "Secret access key",
|
"Secret access key": "Secret access key",
|
||||||
@ -533,7 +539,6 @@
|
|||||||
"The input is not invoice title!": "The input is not invoice title!",
|
"The input is not invoice title!": "The input is not invoice title!",
|
||||||
"The input is not valid Email!": "The input is not valid Email!",
|
"The input is not valid Email!": "The input is not valid Email!",
|
||||||
"The input is not valid Phone!": "The input is not valid Phone!",
|
"The input is not valid Phone!": "The input is not valid Phone!",
|
||||||
"Unknown Check Type": "Unknown Check Type",
|
|
||||||
"Username": "Username",
|
"Username": "Username",
|
||||||
"Username - Tooltip": "Username - Tooltip",
|
"Username - Tooltip": "Username - Tooltip",
|
||||||
"Your account has been created!": "Your account has been created!",
|
"Your account has been created!": "Your account has been created!",
|
||||||
|
@ -6,10 +6,13 @@
|
|||||||
"Sign Up": "Регистрация"
|
"Sign Up": "Регистрация"
|
||||||
},
|
},
|
||||||
"application": {
|
"application": {
|
||||||
|
"Copy SAML metadata URL": "Copy SAML metadata URL",
|
||||||
"Copy prompt page URL": "Copy prompt page URL",
|
"Copy prompt page URL": "Copy prompt page URL",
|
||||||
"Copy signin page URL": "Copy signin page URL",
|
"Copy signin page URL": "Copy signin page URL",
|
||||||
"Copy signup page URL": "Copy signup page URL",
|
"Copy signup page URL": "Copy signup page URL",
|
||||||
"Edit Application": "Изменить приложение",
|
"Edit Application": "Изменить приложение",
|
||||||
|
"Enable SAML compress": "Enable SAML compress",
|
||||||
|
"Enable SAML compress - Tooltip": "Enable SAML compress - Tooltip",
|
||||||
"Enable code signin": "Включить кодовый вход",
|
"Enable code signin": "Включить кодовый вход",
|
||||||
"Enable code signin - Tooltip": "Включить вход с кодом - Tooltip",
|
"Enable code signin - Tooltip": "Включить вход с кодом - Tooltip",
|
||||||
"Enable signin session - Tooltip": "Включить сеанс входа - Подсказка",
|
"Enable signin session - Tooltip": "Включить сеанс входа - Подсказка",
|
||||||
@ -30,6 +33,7 @@
|
|||||||
"Refresh token expire - Tooltip": "Срок обновления токена истекает - Подсказка",
|
"Refresh token expire - Tooltip": "Срок обновления токена истекает - Подсказка",
|
||||||
"SAML metadata": "SAML metadata",
|
"SAML metadata": "SAML metadata",
|
||||||
"SAML metadata - Tooltip": "SAML metadata - Tooltip",
|
"SAML metadata - Tooltip": "SAML metadata - Tooltip",
|
||||||
|
"SAML metadata URL copied to clipboard successfully": "SAML metadata URL copied to clipboard successfully",
|
||||||
"Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser",
|
"Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser",
|
||||||
"Signin session": "Сессия входа",
|
"Signin session": "Сессия входа",
|
||||||
"Signup items": "Элементы регистрации",
|
"Signup items": "Элементы регистрации",
|
||||||
@ -442,6 +446,8 @@
|
|||||||
"SP ACS URL": "SP ACS URL",
|
"SP ACS URL": "SP ACS URL",
|
||||||
"SP ACS URL - Tooltip": "SP ACS URL - Подсказка",
|
"SP ACS URL - Tooltip": "SP ACS URL - Подсказка",
|
||||||
"SP Entity ID": "Идентификатор сущности SP",
|
"SP Entity ID": "Идентификатор сущности SP",
|
||||||
|
"Scene": "Scene",
|
||||||
|
"Scene - Tooltip": "Scene - Tooltip",
|
||||||
"Scope": "Scope",
|
"Scope": "Scope",
|
||||||
"Scope - Tooltip": "Scope - Tooltip",
|
"Scope - Tooltip": "Scope - Tooltip",
|
||||||
"Secret access key": "Секретный ключ доступа",
|
"Secret access key": "Секретный ключ доступа",
|
||||||
@ -533,7 +539,6 @@
|
|||||||
"The input is not invoice title!": "The input is not invoice title!",
|
"The input is not invoice title!": "The input is not invoice title!",
|
||||||
"The input is not valid Email!": "Ввод не является допустимым Email!",
|
"The input is not valid Email!": "Ввод не является допустимым Email!",
|
||||||
"The input is not valid Phone!": "Введен неверный телефон!",
|
"The input is not valid Phone!": "Введен неверный телефон!",
|
||||||
"Unknown Check Type": "Неизвестный тип проверки",
|
|
||||||
"Username": "Имя пользователя",
|
"Username": "Имя пользователя",
|
||||||
"Username - Tooltip": "Имя пользователя - Подсказка",
|
"Username - Tooltip": "Имя пользователя - Подсказка",
|
||||||
"Your account has been created!": "Ваша учетная запись была создана!",
|
"Your account has been created!": "Ваша учетная запись была создана!",
|
||||||
|
@ -6,10 +6,13 @@
|
|||||||
"Sign Up": "注册"
|
"Sign Up": "注册"
|
||||||
},
|
},
|
||||||
"application": {
|
"application": {
|
||||||
|
"Copy SAML metadata URL": "复制SAML元数据URL",
|
||||||
"Copy prompt page URL": "复制提醒页面URL",
|
"Copy prompt page URL": "复制提醒页面URL",
|
||||||
"Copy signin page URL": "复制登录页面URL",
|
"Copy signin page URL": "复制登录页面URL",
|
||||||
"Copy signup page URL": "复制注册页面URL",
|
"Copy signup page URL": "复制注册页面URL",
|
||||||
"Edit Application": "编辑应用",
|
"Edit Application": "编辑应用",
|
||||||
|
"Enable SAML compress": "压缩SAML响应",
|
||||||
|
"Enable SAML compress - Tooltip": "Casdoor作为SAML idp时,是否压缩SAML响应信息",
|
||||||
"Enable code signin": "启用验证码登录",
|
"Enable code signin": "启用验证码登录",
|
||||||
"Enable code signin - Tooltip": "是否允许用手机或邮箱验证码登录",
|
"Enable code signin - Tooltip": "是否允许用手机或邮箱验证码登录",
|
||||||
"Enable signin session - Tooltip": "从应用登录Casdoor后,Casdoor是否保持会话",
|
"Enable signin session - Tooltip": "从应用登录Casdoor后,Casdoor是否保持会话",
|
||||||
@ -30,6 +33,7 @@
|
|||||||
"Refresh token expire - Tooltip": "Refresh Token过期时间",
|
"Refresh token expire - Tooltip": "Refresh Token过期时间",
|
||||||
"SAML metadata": "SAML元数据",
|
"SAML metadata": "SAML元数据",
|
||||||
"SAML metadata - Tooltip": "SAML协议的元数据(Metadata)信息",
|
"SAML metadata - Tooltip": "SAML协议的元数据(Metadata)信息",
|
||||||
|
"SAML metadata URL copied to clipboard successfully": "SAML元数据URL已成功复制到剪贴板",
|
||||||
"Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "登录页面URL已成功复制到剪贴板,请粘贴到当前浏览器的隐身模式窗口或另一个浏览器访问",
|
"Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "登录页面URL已成功复制到剪贴板,请粘贴到当前浏览器的隐身模式窗口或另一个浏览器访问",
|
||||||
"Signin session": "保持登录会话",
|
"Signin session": "保持登录会话",
|
||||||
"Signup items": "注册项",
|
"Signup items": "注册项",
|
||||||
@ -442,6 +446,8 @@
|
|||||||
"SP ACS URL": "SP ACS URL",
|
"SP ACS URL": "SP ACS URL",
|
||||||
"SP ACS URL - Tooltip": "SP ACS URL - 工具提示",
|
"SP ACS URL - Tooltip": "SP ACS URL - 工具提示",
|
||||||
"SP Entity ID": "SP 实体 ID",
|
"SP Entity ID": "SP 实体 ID",
|
||||||
|
"Scene": "Scene",
|
||||||
|
"Scene - Tooltip": "Scene - Tooltip",
|
||||||
"Scope": "Scope",
|
"Scope": "Scope",
|
||||||
"Scope - Tooltip": "Scope - 工具提示",
|
"Scope - Tooltip": "Scope - 工具提示",
|
||||||
"Secret access key": "秘密访问密钥",
|
"Secret access key": "秘密访问密钥",
|
||||||
@ -533,7 +539,6 @@
|
|||||||
"The input is not invoice title!": "您输入的发票抬头有误!",
|
"The input is not invoice title!": "您输入的发票抬头有误!",
|
||||||
"The input is not valid Email!": "您输入的电子邮箱格式有误!",
|
"The input is not valid Email!": "您输入的电子邮箱格式有误!",
|
||||||
"The input is not valid Phone!": "您输入的手机号格式有误!",
|
"The input is not valid Phone!": "您输入的手机号格式有误!",
|
||||||
"Unknown Check Type": "未知的验证码类型",
|
|
||||||
"Username": "用户名",
|
"Username": "用户名",
|
||||||
"Username - Tooltip": "允许字符包括字母、数字、下划线,不得以数字开头",
|
"Username - Tooltip": "允许字符包括字母、数字、下划线,不得以数字开头",
|
||||||
"Your account has been created!": "您的账号已创建!",
|
"Your account has been created!": "您的账号已创建!",
|
||||||
|
Reference in New Issue
Block a user