load the user profile from the IDp api client
549033
function getUserProfile()
    {
        $this->api->curl_header = array(
            'Authorization: OAuth oauth_token='.$this->api->access_token,
        );
        $data = $this->api->get( "admin/rest/v1/me" );

        if ( ! isset( $data->key ) ){
            throw new Exception( "User profile request failed! {$this->providerId} returned an invalid response.", 6 );
        }

        $this->user->profile->identifier  = @ $data->key;
        $this->user->profile->firstName = @ $data->firstName;
        $this->user->profile->firstName = @ $data->firstName;
        $this->user->profile->displayName = @ $data->firstName.' '.$data->lastName;
        $this->user->profile->email = @ $data->email;

        $this->userAccounts = $data->accounts;

        return $this->user->profile;
    }
817320
function profile(username = _noUsernameError()) {
	return co(function *resolveUsername() {
		const userId = yield _getIdByUsername(username);
		const url = `${API}/users/${userId}`;
		const params = { app: 3	};

		return http
			.GET(url, params)
			.then(data => data.profile);
	});
}
1193160
@Override
    public UserProfile addUserProfile(final IPerson person, final IUserProfile profile) {
        final int userId = person.getID();
        final int layoutId = getLayoutId(person, profile);
        // generate an id for this profile

        return jdbcOperations.execute(
                (ConnectionCallback<UserProfile>)
                        con -> {
                            String sQuery;
                            PreparedStatement pstmt =
                                    con.prepareStatement(
                                            "INSERT INTO UP_USER_PROFILE "
                                                    + "(USER_ID, PROFILE_ID, PROFILE_FNAME, PROFILE_NAME, STRUCTURE_SS_ID, THEME_SS_ID,"
                                                    + "DESCRIPTION, LAYOUT_ID) VALUES (?,?,?,?,?,?,?,?)");
                            int profileId = getNextKey();
                            pstmt.setInt(1, userId);
                            pstmt.setInt(2, profileId);
                            pstmt.setString(3, profile.getProfileFname());
                            pstmt.setString(4, profile.getProfileName());
                            pstmt.setInt(5, profile.getStructureStylesheetId());
                            pstmt.setInt(6, profile.getThemeStylesheetId());
                            pstmt.setString(7, profile.getProfileDescription());
                            pstmt.setInt(8, layoutId);
                            sQuery =
                                    "INSERT INTO UP_USER_PROFILE (USER_ID, PROFILE_ID, PROFILE_FNAME, PROFILE_NAME, STRUCTURE_SS_ID, THEME_SS_ID, DESCRIPTION, LAYOUT_ID) VALUES ("
                                            + userId
                                            + ",'"
                                            + profileId
                                            + ",'"
                                            + profile.getProfileFname()
                                            + "','"
                                            + profile.getProfileName()
                                            + "',"
                                            + profile.getStructureStylesheetId()
                                            + ","
                                            + profile.getThemeStylesheetId()
                                            + ",'"
                                            + profile.getProfileDescription()
                                            + "', "
                                            + profile.getLayoutId()
                                            + ")";
                            logger.debug("addUserProfile(): {}", sQuery);
                            try {
                                pstmt.executeUpdate();

                                UserProfile newProfile = new UserProfile();
                                newProfile.setProfileId(profileId);
                                newProfile.setLayoutId(layoutId);
                                newProfile.setLocaleManager(profile.getLocaleManager());
                                newProfile.setProfileDescription(profile.getProfileDescription());
                                newProfile.setProfileFname(profile.getProfileFname());
                                newProfile.setProfileName(profile.getProfileName());
                                newProfile.setStructureStylesheetId(
                                        profile.getStructureStylesheetId());
                                newProfile.setSystemProfile(false);
                                newProfile.setThemeStylesheetId(profile.getThemeStylesheetId());

                                return newProfile;

                            } finally {
                                pstmt.close();
                            }
                        });
    }
630719
public void loadProfile(Object key)
    {
        if (!isEnablePerThreadChanges())
        {
            throw new MetadataException("Can not load profile with disabled per thread mode");
        }
        DescriptorRepository rep = (DescriptorRepository) metadataProfiles.get(key);
        if (rep == null)
        {
            throw new MetadataException("Can not find profile for key '" + key + "'");
        }
        currentProfileKey.set(key);
        setDescriptor(rep);
    }
771062
def import_profile(self):
        
        # noinspection PyCallByClass,PyTypeChecker
        file_name_dialog = QFileDialog(self)
        file_name_dialog.setAcceptMode(QFileDialog.AcceptOpen)
        file_name_dialog.setNameFilter(self.tr('JSON files (*.json *.JSON)'))
        file_name_dialog.setDefaultSuffix('json')
        path_name = resources_path('minimum_needs')
        file_name_dialog.setDirectory(path_name)
        if file_name_dialog.exec_():
            file_name = file_name_dialog.selectedFiles()[0]
        else:
            return -1

        if self.minimum_needs.read_from_file(file_name) == -1:
            return -1

        self.clear_resource_list()
        self.populate_resource_list()
        self.switch_context(self.profile_edit_page)
1285225
def GET_user_profile( self, path_info, user_id ):
        
        if not check_name(user_id) and not check_subdomain(user_id):
            return self._reply_json({'error': 'Invalid name or subdomain'}, status_code=400)

        blockstackd_url = get_blockstackd_url()
        resp = blockstackd_client.resolve_profile(user_id, hostport=blockstackd_url)
        if json_is_error(resp):
            self._reply_json({'error': resp['error']}, status_code=404)
            return

        self._reply_json(resp['profile'])
        return
493893
def get_profile(session):
    """"""
    try:
        profile = session.get(PROFILE_URL).json()
        if 'errorCode' in profile and profile['errorCode'] == '403':
            raise MoparError("not logged in")
        return profile
    except JSONDecodeError:
        raise MoparError("not logged in")
908563
def credentials_loader(self, in_credentials: str = "client_secrets.json") -> dict:
        
        accepted_extensions = (".ini", ".json")
        # checks
        if not path.isfile(in_credentials):
            raise IOError("Credentials file doesn't exist: {}".format(in_credentials))
        else:
            in_credentials = path.normpath(in_credentials)
        if path.splitext(in_credentials)[1] not in accepted_extensions:
            raise ValueError(
                "Extension of credentials file must be one of {}".format(
                    accepted_extensions
                )
            )
        else:
            kind = path.splitext(in_credentials)[1]
        # load, check and set
        if kind == ".json":
            with open(in_credentials, "r") as f:
                in_auth = json.loads(f.read())
            # check structure
            heads = ("installed", "web")
            if not set(in_auth).intersection(set(heads)):
                raise ValueError(
                    "Input JSON structure is not as expected."
                    " First key must be one of: {}".format(heads)
                )
            # set
            if "web" in in_auth:
                # json structure for group application
                auth_settings = in_auth.get("web")
                out_auth = {
                    "auth_mode": "group",
                    "client_id": auth_settings.get("client_id"),
                    "client_secret": auth_settings.get("client_secret"),
                    # if not specified, must be a former file then set classic scope
                    "scopes": auth_settings.get("scopes", ["resources:read"]),
                    "uri_auth": auth_settings.get("auth_uri"),
                    "uri_token": auth_settings.get("token_uri"),
                    "uri_base": self.get_url_base_from_url_token(
                        auth_settings.get("token_uri")
                    ),
                    "uri_redirect": None,
                }
            else:
                # assuming in_auth == 'installed'
                auth_settings = in_auth.get("installed")
                out_auth = {
                    "auth_mode": "user",
                    "client_id": auth_settings.get("client_id"),
                    "client_secret": auth_settings.get("client_secret"),
                    # if not specified, must be a former file then set classic scope
                    "scopes": auth_settings.get("scopes", ["resources:read"]),
                    "uri_auth": auth_settings.get("auth_uri"),
                    "uri_token": auth_settings.get("token_uri"),
                    "uri_base": self.get_url_base_from_url_token(
                        auth_settings.get("token_uri")
                    ),
                    "uri_redirect": auth_settings.get("redirect_uris", None),
                }
        else:
            # assuming file is an .ini
            ini_parser = ConfigParser()
            ini_parser.read(in_credentials)
            # check structure
            if "auth" in ini_parser._sections:
                auth_settings = ini_parser["auth"]
            else:
                raise ValueError(
                    "Input INI structure is not as expected."
                    " Section of credentials must be named: auth"
                )
            # set
            out_auth = {
                "auth_mode": auth_settings.get("CLIENT_TYPE"),
                "client_id": auth_settings.get("CLIENT_ID"),
                "client_secret": auth_settings.get("CLIENT_SECRET"),
                "uri_auth": auth_settings.get("URI_AUTH"),
                "uri_token": auth_settings.get("URI_TOKEN"),
                "uri_base": self.get_url_base_from_url_token(
                    auth_settings.get("URI_TOKEN")
                ),
                "uri_redirect": auth_settings.get("URI_REDIRECT"),
            }
        # method ending
        return out_auth
773698
def get_client_profile(self, client_id):
        
        try:
            response = self._table.get_item(Key={'client_id': client_id})
            compressed_bytes = response['Item']['json_payload'].value
            json_byte_data = zlib.decompress(compressed_bytes)
            json_str_data = json_byte_data.decode('utf8')
            return json.loads(json_str_data)
        except KeyError:
            # No client ID found - not really an error
            return None
        except Exception as e:
            # Return None on error.  The caller in ProfileFetcher will
            # handle error logging
            msg = "Error loading client data for {}.  Error: {}"
            self.logger.debug(msg.format(client_id, str(e)))
            return None
730657
def fromProfileName(cls, name):
        
        with profiles.ProfileStore.open() as config:
            return cls.fromProfile(config.load(name))
557234
String getProfileId() {
        final RxComapiClient client = clientReference.get();
        return client != null ? client.getSession().getProfileId() : null;
    }
1277461
def get_profile(profile, caller, runner):
    '''
    
    '''
    profiles = profile.split(',')
    data = {}
    for profile in profiles:
        if os.path.basename(profile) == profile:
            profile = profile.split('.')[0]  # Trim extension if someone added it
            profile_path = os.path.join(os.path.dirname(__file__), 'profiles', profile + '.yml')
        else:
            profile_path = profile
        if os.path.exists(profile_path):
            try:
                rendered_template = _render_profile(profile_path, caller, runner)
                line = '-' * 80
                log.debug('\n%s\n%s\n%s\n', line, rendered_template, line)
                data.update(yaml.load(rendered_template))
            except Exception as ex:
                log.debug(ex, exc_info=True)
                raise salt.exceptions.SaltException('Rendering profile failed: {}'.format(ex))
        else:
            raise salt.exceptions.SaltException('Profile "{}" is not found.'.format(profile))

    return data
140079
def get_user(self, idvalue, options=None):
        
        options = options or {}
        data = options.copy()
        data['id'] = idvalue
        return self.api_get('user', data)
776497
private UserProfile readProfile(Session session, String userName) throws Exception
   {
      Node profileNode;
      try
      {
         profileNode = utils.getProfileNode(session, userName);
      }
      catch (PathNotFoundException e)
      {
         return null;
      }

      return readProfile(userName, profileNode);
   }
1364153
def get_basic_profile(self, user_id, scope='profile/public'):
        
        profile = _get(
            token=self.oauth.get_app_token(scope),
            uri='/user/profile/' + urllib.quote(user_id)
        )

        try:
            return json.loads(profile)
        except:
            raise MxitAPIException('Error parsing profile data')
642363
def get_profile_info(self, raw_token, profile_info_params={}):
        ""
        try:
            response = self.request('get', self.provider.profile_url, token=raw_token, params=profile_info_params)
            response.raise_for_status()
        except RequestException as e:
            logger.error('Unable to fetch user profile: {0}'.format(e))
            return None
        else:
            return response.json() or response.text
61586
def _identity_loader(self) -> Union[Identity, None]:
        
        if not isinstance(current_user._get_current_object(), AnonymousUser):
            return Identity(current_user.id)