🚚 Rename package

This commit is contained in:
LittleSheep 2024-02-18 11:20:22 +08:00
parent 3437d32273
commit 55a20e18bb
32 changed files with 1747 additions and 65 deletions

View File

@ -25,4 +25,4 @@ jobs:
context: .
file: ./Dockerfile
push: true
tags: xsheep2010/passport:nightly
tags: xsheep2010/identity:nightly

View File

@ -2,7 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Passport.iml" filepath="$PROJECT_DIR$/.idea/Passport.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/Identity.iml" filepath="$PROJECT_DIR$/.idea/Identity.iml" />
</modules>
</component>
</project>

View File

@ -1,5 +1,5 @@
# Building Backend
FROM golang:alpine as passport-server
FROM golang:alpine as identity-server
RUN apk add nodejs npm
@ -14,8 +14,8 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -buildvcs -o /dist ./pkg/cmd/
# Runtime
FROM golang:alpine
COPY --from=passport-server /dist /passport/server
COPY --from=identity-server /dist /identity/server
EXPOSE 8444
CMD ["/passport/server"]
CMD ["/identity/server"]

2
go.mod
View File

@ -1,4 +1,4 @@
module code.smartsheep.studio/hydrogen/passport
module code.smartsheep.studio/hydrogen/identity
go 1.21.5

View File

@ -1,14 +1,14 @@
package main
import (
"code.smartsheep.studio/hydrogen/passport/pkg/external"
"code.smartsheep.studio/hydrogen/passport/pkg/server"
"code.smartsheep.studio/hydrogen/identity/pkg/external"
"code.smartsheep.studio/hydrogen/identity/pkg/server"
"os"
"os/signal"
"syscall"
passport "code.smartsheep.studio/hydrogen/passport/pkg"
"code.smartsheep.studio/hydrogen/passport/pkg/database"
identity "code.smartsheep.studio/hydrogen/identity/pkg"
"code.smartsheep.studio/hydrogen/identity/pkg/database"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
@ -51,11 +51,11 @@ func main() {
go server.Listen()
// Messages
log.Info().Msgf("Passport v%s is started...", passport.AppVersion)
log.Info().Msgf("Passport v%s is started...", identity.AppVersion)
quit := make(chan os.Signal, 1)
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
<-quit
log.Info().Msgf("Passport v%s is quitting...", passport.AppVersion)
log.Info().Msgf("Passport v%s is quitting...", identity.AppVersion)
}

View File

@ -1,7 +1,7 @@
package database
import (
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
"gorm.io/gorm"
)

View File

@ -1,4 +1,4 @@
package passport
package identity
const (
AppVersion = "1.0.0"

View File

@ -4,8 +4,8 @@ import (
"fmt"
"time"
"code.smartsheep.studio/hydrogen/passport/pkg/database"
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/database"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
"github.com/samber/lo"
"gorm.io/datatypes"
)

View File

@ -1,7 +1,7 @@
package security
import (
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
"fmt"
"github.com/samber/lo"
)

View File

@ -5,8 +5,8 @@ import (
"strconv"
"time"
"code.smartsheep.studio/hydrogen/passport/pkg/database"
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/database"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
"github.com/google/uuid"
"github.com/samber/lo"
)

View File

@ -1,9 +1,9 @@
package server
import (
"code.smartsheep.studio/hydrogen/passport/pkg/database"
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/passport/pkg/services"
"code.smartsheep.studio/hydrogen/identity/pkg/database"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/services"
"fmt"
"github.com/gofiber/fiber/v2"
jsoniter "github.com/json-iterator/go"

View File

@ -1,8 +1,8 @@
package server
import (
"code.smartsheep.studio/hydrogen/passport/pkg/security"
"code.smartsheep.studio/hydrogen/passport/pkg/services"
"code.smartsheep.studio/hydrogen/identity/pkg/security"
"code.smartsheep.studio/hydrogen/identity/pkg/services"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/keyauth"
)

View File

@ -1,8 +1,8 @@
package server
import (
"code.smartsheep.studio/hydrogen/passport/pkg/database"
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/database"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
"github.com/gofiber/fiber/v2"
"github.com/google/uuid"
"github.com/spf13/viper"

View File

@ -4,8 +4,8 @@ import (
"github.com/gofiber/fiber/v2"
"time"
"code.smartsheep.studio/hydrogen/passport/pkg/security"
"code.smartsheep.studio/hydrogen/passport/pkg/services"
"code.smartsheep.studio/hydrogen/identity/pkg/security"
"code.smartsheep.studio/hydrogen/identity/pkg/services"
"github.com/samber/lo"
)
@ -69,7 +69,7 @@ func doChallenge(c *fiber.Ctx) error {
if err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
} else if challenge.Progress >= challenge.Requirements {
session, err := security.GrantSession(challenge, []string{"*"}, []string{"passport"}, nil, lo.ToPtr(time.Now()))
session, err := security.GrantSession(challenge, []string{"*"}, []string{"identity"}, nil, lo.ToPtr(time.Now()))
if err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
}

View File

@ -1,7 +1,7 @@
package server
import (
"code.smartsheep.studio/hydrogen/passport/pkg/services"
"code.smartsheep.studio/hydrogen/identity/pkg/services"
"github.com/gofiber/fiber/v2"
)

View File

@ -1,9 +1,9 @@
package server
import (
"code.smartsheep.studio/hydrogen/passport/pkg/database"
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/passport/pkg/services"
"code.smartsheep.studio/hydrogen/identity/pkg/database"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/services"
"github.com/gofiber/fiber/v2"
"github.com/samber/lo"
"time"

View File

@ -1,8 +1,8 @@
package server
import (
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/passport/pkg/services"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/services"
"github.com/gofiber/fiber/v2"
)

View File

@ -1,10 +1,10 @@
package server
import (
"code.smartsheep.studio/hydrogen/passport/pkg/database"
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/passport/pkg/security"
"code.smartsheep.studio/hydrogen/passport/pkg/services"
"code.smartsheep.studio/hydrogen/identity/pkg/database"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/security"
"code.smartsheep.studio/hydrogen/identity/pkg/services"
"github.com/gofiber/fiber/v2"
"github.com/samber/lo"
"strings"
@ -76,7 +76,7 @@ func doConnect(c *fiber.Ctx) error {
user,
client,
strings.Split(scope, " "),
[]string{"passport", client.Alias},
[]string{"identity", client.Alias},
nil,
lo.ToPtr(time.Now()),
c.IP(),
@ -98,7 +98,7 @@ func doConnect(c *fiber.Ctx) error {
user,
client,
strings.Split(scope, " "),
[]string{"passport", client.Alias},
[]string{"identity", client.Alias},
nil,
lo.ToPtr(time.Now()),
c.IP(),

View File

@ -1,8 +1,8 @@
package server
import (
"code.smartsheep.studio/hydrogen/passport/pkg/database"
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/database"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
"github.com/gofiber/fiber/v2"
)

View File

@ -1,7 +1,7 @@
package server
import (
"code.smartsheep.studio/hydrogen/passport/pkg/view"
"code.smartsheep.studio/hydrogen/identity/pkg/view"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cache"
"github.com/gofiber/fiber/v2/middleware/cors"

View File

@ -1,9 +1,9 @@
package services
import (
"code.smartsheep.studio/hydrogen/passport/pkg/database"
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/passport/pkg/security"
"code.smartsheep.studio/hydrogen/identity/pkg/database"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/security"
"fmt"
"github.com/google/uuid"
"github.com/samber/lo"

View File

@ -1,8 +1,8 @@
package services
import (
"code.smartsheep.studio/hydrogen/passport/pkg/database"
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/database"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
)
func LookupChallenge(id uint) (models.AuthChallenge, error) {

View File

@ -1,8 +1,8 @@
package services
import (
"code.smartsheep.studio/hydrogen/passport/pkg/database"
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/database"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
"fmt"
)

View File

@ -1,8 +1,8 @@
package services
import (
"code.smartsheep.studio/hydrogen/passport/pkg/database"
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/database"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
)
func AddEvent(user models.Account, event, target, ip, ua string) models.ActionEvent {

View File

@ -1,8 +1,8 @@
package services
import (
"code.smartsheep.studio/hydrogen/passport/pkg/database"
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/database"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
"fmt"
"github.com/google/uuid"
"github.com/spf13/viper"

View File

@ -1,9 +1,9 @@
package services
import (
"code.smartsheep.studio/hydrogen/passport/pkg/database"
"code.smartsheep.studio/hydrogen/passport/pkg/external"
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/database"
"code.smartsheep.studio/hydrogen/identity/pkg/external"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
"context"
"firebase.google.com/go/messaging"
"github.com/rs/zerolog/log"

View File

@ -1,8 +1,8 @@
package services
import (
"code.smartsheep.studio/hydrogen/passport/pkg/database"
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/database"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
)
func LookupSessionWithToken(tokenId string) (models.AuthSession, error) {

View File

@ -1,8 +1,8 @@
package services
import (
"code.smartsheep.studio/hydrogen/passport/pkg/database"
"code.smartsheep.studio/hydrogen/passport/pkg/models"
"code.smartsheep.studio/hydrogen/identity/pkg/database"
"code.smartsheep.studio/hydrogen/identity/pkg/models"
"fmt"
"github.com/google/uuid"
"github.com/spf13/viper"

View File

@ -1,5 +1,5 @@
{
"name": "@hydrogen/passport-web",
"name": "@hydrogen/identity-web",
"private": true,
"version": "0.0.0",
"type": "module",

1682
pkg/view/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -22,8 +22,8 @@ username = "alphabot@smartsheep.studio"
password = "gz937Zxxzfcd9SeH"
[database]
dsn = "host=localhost dbname=hy_passport port=5432 sslmode=disable"
prefix = "passport_"
dsn = "host=localhost dbname=hy_identity port=5432 sslmode=disable"
prefix = "identity_"
[[directory]]
name = "Goatpass"