Register the member and return an enrollment secret.
@param req Registration request with the following fields: name, role
@param registrar The identity of the registrar (i.e. who is performing the registration)
349665
public String register(RegistrationRequest req, Member registrar) throws RegistrationException {
    	if (StringUtil.isNullOrEmpty(req.getEnrollmentID())) {
    		throw new IllegalArgumentException("EntrollmentID cannot be null or empty");
    	}

    	if (registrar == null) {
    		throw new IllegalArgumentException("Registrar should be a valid member");
    	}


    	Registrar reg = Registrar.newBuilder()
    			.setId(
    					Identity.newBuilder()
    					.setId(registrar.getName())
    					.build())
    			.build(); //TODO: set Roles and Delegate Roles

    	RegisterUserReq.Builder regReqBuilder = RegisterUserReq.newBuilder();
    	regReqBuilder.setId(
    					Identity.newBuilder()
    					.setId(req.getEnrollmentID())
    					.build());
    	regReqBuilder.setRoleValue(rolesToMask(req.getRoles()));
    	regReqBuilder.setAffiliation(req.getAffiliation());
    	regReqBuilder.setRegistrar(reg);

    	RegisterUserReq registerReq = regReqBuilder.build();
    	byte[] buffer = registerReq.toByteArray();

    	try {
            java.security.PrivateKey signKey = cryptoPrimitives.ecdsaKeyFromPrivate(Hex.decode(registrar.getEnrollment().getKey()));
	    	logger.debug("Retreived private key");
            BigInteger[] signature = cryptoPrimitives.ecdsaSign(signKey, buffer);
	    	logger.debug("Signed the request with key");
            Signature sig = Signature.newBuilder().setType(CryptoType.ECDSA).setR(ByteString.copyFrom(signature[0].toString().getBytes())).setS(ByteString.copyFrom(signature[1].toString().getBytes())).build();
			regReqBuilder.setSig(sig);
	    	logger.debug("Now sendingt register request");
			Token token = this.ecaaClient.registerUser(regReqBuilder.build());
			return token.getTok().toStringUtf8();

		} catch (Exception e) {
			throw new RegistrationException("Error while registering the user", e);
		}

    }
844791
def client_registration(self, context):
        
        try:
            resp = self.provider.handle_client_registration_request(json.dumps(context.request))
            return Created(resp.to_json(), content="application/json")
        except InvalidClientRegistrationRequest as e:
            return BadRequest(e.to_json(), content="application/json")
158130
def _register_rp(session, url_prefix, rp_name):
    
    post_url = "{}providers/{}/register?api-version=2016-02-01".format(url_prefix, rp_name)
    get_url = "{}providers/{}?api-version=2016-02-01".format(url_prefix, rp_name)
    _LOGGER.warning("Resource provider '%s' used by this operation is not "
                    "registered. We are registering for you.", rp_name)
    post_response = session.post(post_url)
    if post_response.status_code != 200:
        _LOGGER.warning("Registration failed. Please register manually.")
        return False

    while True:
        time.sleep(10)
        rp_info = session.get(get_url).json()
        if rp_info['registrationState'] == 'Registered':
            _LOGGER.warning("Registration succeeded.")
            return True
832064
function register (server, options, next) {
  server.ext('onPreHandler', function maybeForceGzip (request, reply) {
    if (request.query.force_gzip === 'true') {
      request.info.acceptEncoding = 'gzip'
    }
    reply.continue()
  })

  next()
}
91098
private IAuthorizationPrincipal getAuthorizationPrincipal(HttpServletRequest req) {
        IPerson user = personManager.getPerson(req);
        EntityIdentifier ei = user.getEntityIdentifier();
        IAuthorizationPrincipal rslt =
                AuthorizationServiceFacade.instance().newPrincipal(ei.getKey(), ei.getType());
        return rslt;
    }
236300
@Override
	public void registerOsgiProvider (Object provider) throws FhirConfigurationException {
		if (null == provider) {
			throw new NullPointerException("FHIR Provider cannot be null");
		}
		try {
			super.registerProvider(provider);
			log.trace("registered provider. class ["+provider.getClass().getName()+"]");
			this.serverProviders.add(provider);
		} catch (Exception e) {
			log.error("Error registering FHIR Provider", e);
			throw new FhirConfigurationException("Error registering FHIR Provider", e);
		}
	}
134518
def register(self):
        
        user = {}

        print('--------------------------------------------------------------')
        print('Welcome to the user registration process.')
        print('--------------------------------------------------------------')
        print("To continue you must fill the following fields.")
        for attribute, value in self.attributes.items():

            is_required = attribute in self.required
            field_name = value['field_name']
            pattern = value['pattern']

            if attribute != 'password':
                user[attribute] = self.ask_question(field_name, pattern,
                                                    is_required)
            else:
                user[attribute] = self.ask_question(field_name, pattern,
                                                    password=True)

        return self._users_client.register(user)
1368834
private ServiceRegistration<?> registerMBeanService(String jmsResourceName, BundleContext bundleContext) {
        Dictionary<String, String> props = new Hashtable<String, String>();
        props.put(KEY_SERVICE_VENDOR, "IBM");

        JmsServiceProviderMBeanImpl jmsProviderMBean = new JmsServiceProviderMBeanImpl(getServerName(), KEY_JMS2_PROVIDER);
        props.put(KEY_JMX_OBJECTNAME, jmsProviderMBean.getobjectName());

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "JmsQueueMBeanImpl=" + jmsProviderMBean.getobjectName() + " props=" + props);
        }
        return bundleContext.registerService(JmsServiceProviderMBeanImpl.class, jmsProviderMBean, props);
    }
1280830
private ServiceRegistration registerCrud(BundleContext context, JcrCrudService crud) {
        Dictionary prop = jcromConfiguration.toDictionary();
        prop.put(Crud.ENTITY_CLASS_PROPERTY, crud.getEntityClass());
        prop.put(Crud.ENTITY_CLASSNAME_PROPERTY, crud.getEntityClass().getName());
        ServiceRegistration serviceRegistration = context.registerService(new String[]{Crud.class.getName(), JcrCrud.class.getName()}, crud, prop);
        return serviceRegistration;
    }
1073694
def register(request):
    '''
    
    '''
    serializer_class = registration_settings.REGISTER_SERIALIZER_CLASS
    serializer = serializer_class(data=request.data)
    serializer.is_valid(raise_exception=True)

    kwargs = {}

    if registration_settings.REGISTER_VERIFICATION_ENABLED:
        verification_flag_field = get_user_setting('VERIFICATION_FLAG_FIELD')
        kwargs[verification_flag_field] = False
        email_field = get_user_setting('EMAIL_FIELD')
        if (email_field not in serializer.validated_data
                or not serializer.validated_data[email_field]):
            raise BadRequest("User without email cannot be verified")

    user = serializer.save(**kwargs)

    output_serializer_class = registration_settings.REGISTER_OUTPUT_SERIALIZER_CLASS  # noqa: E501
    output_serializer = output_serializer_class(instance=user)
    user_data = output_serializer.data

    if registration_settings.REGISTER_VERIFICATION_ENABLED:
        signer = RegisterSigner({
            'user_id': user.pk,
        }, request=request)
        template_config = (
            registration_settings.REGISTER_VERIFICATION_EMAIL_TEMPLATES)
        send_verification_notification(user, signer, template_config)

    return Response(user_data, status=status.HTTP_201_CREATED)
1320614
def registerAccount(self, person, vendorSpecific=None):
        
        response = self.registerAccountResponse(person, vendorSpecific)
        return self._read_boolean_response(response)
93085
public void registerDeferredService(BundleContext bundleContext, Class<?> providedService, Dictionary dict) {
        Object obj = serviceReg.get();
        if (obj instanceof ServiceRegistration<?>) {
            // already registered - nothing to do here
            return;
        }
        if (obj instanceof CountDownLatch) {
            // another thread is in the process of (de)registering - wait for it to finish
            try {
                ((CountDownLatch) obj).await();

                if (serviceReg.get() instanceof ServiceRegistration<?>) {
                    // Another thread has successfully registered to return out (so we don't go
                    // into recursive loop).
                    return;
                }
            } catch (InterruptedException swallowed) {
                if (tc.isDebugEnabled()) {
                    Tr.debug(tc, "Count down interrrupted", swallowed);
                }
            }
        } else {
            // This is probably the first thread to register.
            // Claim the right to register by setting a latch for other threads to wait on.
            CountDownLatch latch = new CountDownLatch(1);
            if (serviceReg.compareAndSet(null, latch)) {
                // This thread won the right to register the service
                try {
                    serviceReg.set(bundleContext.registerService(providedService.getName(), this, dict));
                    // successfully registered - nothing more to do
                    return;
                } finally {
                    // if the serviceReg was not updated for any reason, we need to set it back to null
                    serviceReg.compareAndSet(latch, null);
                    // in any case we need to allow any blocked threads to proceed
                    latch.countDown();
                }
            }
        }
        // If we get to here we have not successfully registered 
        // nor seen another thread successfully register, so just recurse.
        registerDeferredService(bundleContext, providedService, dict);
    }
952935
public <A> A register(final String name, final Class<? extends A> clazz, final A rs) {
        return register(true, name, clazz, rs);
    }
1166004
def dispatch(self, request, *args, **kwargs):
        '''
        
        '''
        self.returnJson = (request.POST.get('json') in ['true', True])

        regonline = getConstant('registration__registrationEnabled')
        if not regonline:
            returnUrl = reverse('registrationOffline')

            if self.returnJson:
                return JsonResponse({'status': 'success', 'redirect': returnUrl})
            return HttpResponseRedirect(returnUrl)

        return super().dispatch(request, *args, **kwargs)
529528
private void registerQuickStartSecurityAdministratorRole() {
        if (bc == null) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "BundleContext is null, we must be deactivated.");
            }
            return;
        }
        if (managementRoleReg != null) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "QuickStartSecurityAdministratorRole is already registered.");
            }
            return;
        }
        if (urConfigReg == null) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "QuickStartSecurityRegistry configuration is not registered, will not register QuickStartSecurityAdministratorRole.");
            }
            return;
        }
        if (isStringValueUndefined(config.userName())) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "User is not set, can not register the QuickStartSecurityAdministratorRole");
            }
            return;
        }
        if (!managementRoles.isEmpty()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Other managment roles are present, will not register the QuickStartSecurityAdministratorRole");
            }
            return;
        }

        Dictionary<String, Object> props = new Hashtable<String, Object>();
        props.put(ManagementRole.MANAGEMENT_ROLE_NAME, QUICK_START_ADMINISTRATOR_ROLE_NAME);
        props.put("service.vendor", "IBM");

        managementRole = new QuickStartSecurityAdministratorRole(config.userName());
        managementRoleReg = bc.registerService(ManagementRole.class,
                                               managementRole,
                                               props);
    }
403259
def register(self, entity_cls, provider_name=None):
        
        self._validate_entity_cls(entity_cls)

        # Register the entity if not registered already
        entity_name = fully_qualified_name(entity_cls)
        provider_name = provider_name or entity_cls.meta_.provider or 'default'

        try:
            entity = self._get_entity_by_class(entity_cls)

            if entity:
                # This probably is an accidental re-registration of the entity
                #   and we should warn the user of a possible repository confusion
                raise ConfigurationError(
                    f'Entity {entity_name} has already been registered')
        except AssertionError:
            # Entity has not been registered yet. Let's go ahead and add it to the registry.
            entity_record = RepositoryFactory.EntityRecord(
                name=entity_cls.__name__,
                qualname=entity_name,
                entity_cls=entity_cls,
                provider_name=provider_name,
                model_cls=None
            )
            self._registry[entity_name] = entity_record
            logger.debug(
                f'Registered entity {entity_name} with provider {provider_name}')
42628
protected static void getRegistrationId(OrtcClient ortcClient){
		if (checkPlayServices(ortcClient)) {
            gcm = GoogleCloudMessaging.getInstance(ortcClient.appContext);

            if (ortcClient.registrationId.isEmpty()){
                String regid = getRegistrationId(ortcClient.appContext);
                ortcClient.registrationId = regid;
                if (regid.isEmpty()) {
                    registerInBackground(ortcClient);
                }
            }

        } else {
        	ortcClient.raiseOrtcEvent(EventEnum.OnException, ortcClient, new OrtcGcmException("No valid Google Play Services APK found."));
        }
	}