當前位置: 首頁>>代碼示例>>Golang>>正文


Golang RegistrationAuthority.DeactivateRegistration方法代碼示例

本文整理匯總了Golang中github.com/letsencrypt/boulder/core.RegistrationAuthority.DeactivateRegistration方法的典型用法代碼示例。如果您正苦於以下問題:Golang RegistrationAuthority.DeactivateRegistration方法的具體用法?Golang RegistrationAuthority.DeactivateRegistration怎麽用?Golang RegistrationAuthority.DeactivateRegistration使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/letsencrypt/boulder/core.RegistrationAuthority的用法示例。


在下文中一共展示了RegistrationAuthority.DeactivateRegistration方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: NewRegistrationAuthorityServer


//.........這裏部分代碼省略.........
			improperMessage(MethodUpdateRegistration, err, req)
			return
		}

		reg, err := impl.UpdateRegistration(ctx, urReq.Base, urReq.Update)
		if err != nil {
			return
		}

		response, err = json.Marshal(reg)
		if err != nil {
			errorCondition(MethodUpdateRegistration, err, req)
			return
		}
		return
	})

	rpc.Handle(MethodUpdateAuthorization, func(ctx context.Context, req []byte) (response []byte, err error) {
		var uaReq updateAuthorizationRequest
		err = json.Unmarshal(req, &uaReq)
		if err != nil {
			improperMessage(MethodUpdateAuthorization, err, req)
			return
		}

		newAuthz, err := impl.UpdateAuthorization(ctx, uaReq.Authz, uaReq.Index, uaReq.Response)
		if err != nil {
			return
		}

		response, err = json.Marshal(newAuthz)
		if err != nil {
			errorCondition(MethodUpdateAuthorization, err, req)
			return
		}
		return
	})

	rpc.Handle(MethodRevokeCertificateWithReg, func(ctx context.Context, req []byte) (response []byte, err error) {
		var revReq struct {
			Cert   []byte
			Reason revocation.Reason
			RegID  int64
		}
		if err = json.Unmarshal(req, &revReq); err != nil {
			improperMessage(MethodRevokeCertificateWithReg, err, req)
			return
		}
		cert, err := x509.ParseCertificate(revReq.Cert)
		if err != nil {
			return
		}

		err = impl.RevokeCertificateWithReg(ctx, *cert, revReq.Reason, revReq.RegID)
		return
	})

	rpc.Handle(MethodAdministrativelyRevokeCertificate, func(ctx context.Context, req []byte) (response []byte, err error) {
		var revReq struct {
			Cert   []byte
			Reason revocation.Reason
			User   string
		}
		if err = json.Unmarshal(req, &revReq); err != nil {
			improperMessage(MethodAdministrativelyRevokeCertificate, err, req)
			return
		}
		cert, err := x509.ParseCertificate(revReq.Cert)
		if err != nil {
			return
		}

		err = impl.AdministrativelyRevokeCertificate(ctx, *cert, revReq.Reason, revReq.User)
		return
	})

	rpc.Handle(MethodDeactivateAuthorization, func(ctx context.Context, req []byte) (response []byte, err error) {
		var authz core.Authorization
		err = json.Unmarshal(req, &authz)
		if err != nil {
			errorCondition(MethodDeactivateAuthorization, err, req)
			return
		}
		err = impl.DeactivateAuthorization(ctx, authz)
		return
	})

	rpc.Handle(MethodDeactivateRegistration, func(ctx context.Context, req []byte) (response []byte, err error) {
		var reg core.Registration
		err = json.Unmarshal(req, &reg)
		if err != nil {
			errorCondition(MethodDeactivateRegistration, err, req)
			return
		}
		err = impl.DeactivateRegistration(ctx, reg)
		return
	})

	return nil
}
開發者ID:jfrazelle,項目名稱:boulder,代碼行數:101,代碼來源:rpc-wrappers.go


注:本文中的github.com/letsencrypt/boulder/core.RegistrationAuthority.DeactivateRegistration方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。