This commit is contained in:
crusader 2018-04-11 23:23:47 +09:00
parent 33dfa4bdcc
commit 9f76eace03
4 changed files with 16 additions and 16 deletions

View File

@ -1,9 +1,10 @@
package config package config
import ( import (
"crypto/rsa"
occe "git.loafle.net/overflow/commons-go/config/external" occe "git.loafle.net/overflow/commons-go/config/external"
ogrs "git.loafle.net/overflow/gateway_rest/server" ogrs "git.loafle.net/overflow/gateway_rest/server"
"crypto/rsa"
) )
type Config struct { type Config struct {

View File

@ -1,12 +1,12 @@
package server package server
import ( import (
ccf "git.loafle.net/commons/cors-go/fasthttp"
cs "git.loafle.net/commons/server-go" cs "git.loafle.net/commons/server-go"
oge "git.loafle.net/overflow/gateway/external" oge "git.loafle.net/overflow/gateway/external"
ogrs "git.loafle.net/overflow/gateway_rest/server" ogrs "git.loafle.net/overflow/gateway_rest/server"
"git.loafle.net/overflow/member_gateway_rest/config" "git.loafle.net/overflow/member_gateway_rest/config"
"github.com/valyala/fasthttp" "github.com/valyala/fasthttp"
ccf "git.loafle.net/commons/cors-go/fasthttp"
) )
type ServerHandler interface { type ServerHandler interface {
@ -16,7 +16,7 @@ type ServerHandler interface {
type ServerHandlers struct { type ServerHandlers struct {
ogrs.ServerHandlers ogrs.ServerHandlers
Config *config.Config Config *config.Config
corsHandler ccf.Cors corsHandler ccf.Cors
} }

View File

@ -14,7 +14,6 @@ func NewServer(_config *config.Config) *cswf.Server {
cdr.RegisterResource("VerifyKey", _config.VerifyKey) cdr.RegisterResource("VerifyKey", _config.VerifyKey)
cdr.RegisterResource("SignKey", _config.SignKey) cdr.RegisterResource("SignKey", _config.SignKey)
services, err := cdr.GetInstancesByAnnotationType(oca.RESTServiceAnnotationType) services, err := cdr.GetInstancesByAnnotationType(oca.RESTServiceAnnotationType)
if nil != err { if nil != err {
logging.Logger().Panic(err) logging.Logger().Panic(err)

View File

@ -16,29 +16,29 @@ import (
"git.loafle.net/overflow/gateway/external/grpc" "git.loafle.net/overflow/gateway/external/grpc"
"github.com/valyala/fasthttp" "github.com/valyala/fasthttp"
"github.com/dgrijalva/jwt-go"
"net/url" "net/url"
)
"github.com/dgrijalva/jwt-go"
)
var MemberServiceType = reflect.TypeOf((*MemberService)(nil)) var MemberServiceType = reflect.TypeOf((*MemberService)(nil))
func init() { func init() {
cdr.RegisterType(MemberServiceType) cdr.RegisterType(MemberServiceType)
} }
type MemberService struct { type MemberService struct {
cda.TypeAnnotation `annotation:"@overflow:RESTService()"` cda.TypeAnnotation `annotation:"@overflow:RESTService()"`
VerifyKey *rsa.PublicKey `annotation:"@Resource(name='VerifyKey')"` VerifyKey *rsa.PublicKey `annotation:"@Resource(name='VerifyKey')"`
SignKey *rsa.PrivateKey `annotation:"@Resource(name='SignKey')"` SignKey *rsa.PrivateKey `annotation:"@Resource(name='SignKey')"`
_Signin cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/signin', params='[signinID, signinPW]')"` _Signin cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/signin', params='[signinID, signinPW]')"`
_SigninByCookie cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/signin_cookie', params='[authToken]')"` _SigninByCookie cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/signin_cookie', params='[authToken]')"`
_Signup cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/signup', params='[member, pw]')"` _Signup cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/signup', params='[member, pw]')"`
_EmailConfirm cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='GET', entry='/account/email_confirm', params='[token]')"` _EmailConfirm cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='GET', entry='/account/email_confirm', params='[token]')"`
_ForgotPassword cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/forgot_password', params='[signinID]')"` _ForgotPassword cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/forgot_password', params='[signinID]')"`
_ResetPwConfirm cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/reset_pw_confirm', params='[pw, key]')"` _ResetPwConfirm cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/reset_pw_confirm', params='[pw, key]')"`
} }
func (ms *MemberService) EmailConfirm(servletCtx server.ServletCtx, ctx *fasthttp.RequestCtx, token string) error { func (ms *MemberService) EmailConfirm(servletCtx server.ServletCtx, ctx *fasthttp.RequestCtx, token string) error {
@ -180,4 +180,4 @@ func (ms *MemberService) ResetPwConfirm(servletCtx server.ServletCtx, ctx *fasth
ctx.SetBody([]byte(r)) ctx.SetBody([]byte(r))
return nil return nil
} }