def create_login(user_resource_id, auth_type, auth_key, auth_data=None): """ """ # Note: Do this in a more api friendly manner.... # TODO: Try/catch this stuff.... user_key = get_key_from_resource_id(user_resource_id) user = user_key.get() if not auth_type == 'basic': raise Exception('unsupported provider: %s' % auth_type) # Wrap this in a service auth_type, auth_key, auth_data = basic.get_login_properties(user, auth_key, auth_data) key = AuthUserMethodEntity.generate_key(user.key, auth_type, auth_key) login_entity = AuthUserMethodEntity(key=key) login_entity.auth_type = auth_type login_entity.auth_key = auth_key login_entity.auth_data = auth_data login_entity.user_key = user.key # TODO: Eventually it's just resource_id login_entity.put() login_model = _populate_model(login_entity) return login_model
def create_login(user, auth_type, auth_key, auth_data=None): """ TODO: Replace this with auth_core.api.logins.create_login """ if not auth_type == 'basic': raise Exception('unsupported provider') auth_type, auth_key, auth_data = basic.get_login_properties( user, auth_key, auth_data) key = AuthUserMethodEntity.generate_key(user.key, auth_type, auth_key) login = AuthUserMethodEntity(key=key) login.auth_type = auth_type login.auth_key = auth_key login.auth_data = auth_data login.user_key = user.key login.put() return login