当前位置: 首页>>代码示例>>PHP>>正文


PHP Authenticatable::getAuthIdentifier方法代码示例

本文整理汇总了PHP中Illuminate\Contracts\Auth\Authenticatable::getAuthIdentifier方法的典型用法代码示例。如果您正苦于以下问题:PHP Authenticatable::getAuthIdentifier方法的具体用法?PHP Authenticatable::getAuthIdentifier怎么用?PHP Authenticatable::getAuthIdentifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Contracts\Auth\Authenticatable的用法示例。


在下文中一共展示了Authenticatable::getAuthIdentifier方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validateCredentials

 public function validateCredentials(UserContract $user, array $credentials)
 {
     $profile = $user instanceof Account ? $user : Account::find($user->getAuthIdentifier());
     if ($profile && $profile->id == $user->getAuthIdentifier()) {
         return static::PAMAuthenticate($profile->username, $credentials['password']);
     }
     return false;
 }
开发者ID:SYpanel,项目名称:SYpanel,代码行数:8,代码来源:PAMUserProvider.php

示例2: create

 /**
  * Creates an auth token for user.
  *
  * @param \Illuminate\Contracts\Auth\Authenticatable $user
  * @return \TAppleby\AuthToken\AuthToken|false
  */
 public function create(Authenticatable $user)
 {
     if ($user == null || $user->getAuthIdentifier() == null) {
         return false;
     }
     $token = $this->generateAuthToken();
     $token->setAuthIdentifier($user->getAuthIdentifier());
     $t = new \DateTime();
     $insertData = array_merge($token->toArray(), array('created_at' => $t, 'updated_at' => $t));
     $this->db()->insert($insertData);
     return $token;
 }
开发者ID:Rareloop,项目名称:laravel-auth-token,代码行数:18,代码来源:DatabaseAuthTokenProvider.php

示例3: getOrganizationMember

 /**
  * @param UserContract $user
  * @return OrganizationMember
  */
 public function getOrganizationMember(UserContract $user)
 {
     $memberClass = $this->getOrgMemberClass();
     $queryMethod = $memberClass->getMethod('query');
     $builder = $queryMethod->invoke(null);
     $member = $builder->where('user_id', '=', $user->getAuthIdentifier())->first();
     return $member;
 }
开发者ID:democracyapps,项目名称:member-org,代码行数:12,代码来源:EloquentMemberOrganization.php

示例4: validateCredentials

 /**
  * Validate a user against the given credentials.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable $user
  * @param  array $credentials
  * @return bool
  */
 public function validateCredentials(Authenticatable $user, array $credentials)
 {
     try {
         $result = $this->application->authenticate($credentials['email'], $credentials['password']);
         return $result->account->getHref() == $user->getAuthIdentifier();
     } catch (\Exception $e) {
         return false;
     }
 }
开发者ID:stormpath,项目名称:stormpath-laravel-auth-driver,代码行数:16,代码来源:StormpathUserProvider.php

示例5: handle

 /**
  * Handle user logged in.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  *
  * @return bool|null
  */
 public function handle(Authenticatable $user)
 {
     $social = $this->session->get('authentication.social.oauth');
     if (is_null($social)) {
         return;
     }
     $model = User::where('provider', '=', $social['provider'])->where('uid', '=', $social['user']->getId())->first();
     if (is_null($model)) {
         return;
     }
     $model->setAttribute('user_id', $user->getAuthIdentifier());
     $model->save();
     return true;
 }
开发者ID:vitalysemenov,项目名称:oauth,代码行数:21,代码来源:UserLoggedIn.php

示例6: log

 /**
  * Log activity
  *
  * @param string          $action
  * @param string          $description
  * @param \Eloquent       $content
  * @param Authenticatable $user
  * @param Request         $request
  *
  * @return bool
  */
 public function log($action, $description, $content = null, Authenticatable $user = null, Request $request = null)
 {
     $user_id = null;
     $user_type = null;
     $user_name = null;
     if ($user) {
         $user_id = $user->getAuthIdentifier();
         $user_type = get_class($user);
         $user_name = $user->getAuthIdentifierName();
     }
     $content_type = is_object($content) ? get_class($content) : null;
     $content_id = is_object($content) ? $content->id : null;
     $ip_address = $request->ip();
     return (bool) $this->model->create(['action' => $action, 'user_id' => $user_id, 'user_type' => $user_type, 'user_name' => $user_name, 'description' => $description, 'ip_address' => $ip_address, 'content_type' => $content_type, 'content_id' => $content_id]);
 }
开发者ID:naturalweb,项目名称:nwlaravel,代码行数:26,代码来源:DefaultHandler.php

示例7: login

 /**
  * Log a user into the application.
  *
  * @param \Illuminate\Contracts\Auth\Authenticatable $user
  * @return void
  */
 public function login(AuthenticatableContract $user)
 {
     $claim = new Claim(['sub' => $user->getAuthIdentifier(), 'aud' => get_class($user), 'refresh' => Config::get('jwt.refreshable')]);
     $token = $this->jwtService->getTokenForClaim($claim);
     // If we have an event dispatcher instance set we will fire an event so that
     // any listeners will hook into the authentication events and run actions
     // based on the login and logout events fired from the guard instances.
     $this->fireLoginEvent($user);
     $this->setToken($token);
     $this->setUser($user);
 }
开发者ID:wisoot,项目名称:jwt-guard,代码行数:17,代码来源:JwtGuard.php

示例8: updateRememberToken

 /**
  * Update the "remember me" token for the given user in storage.
  *
  * @param \Illuminate\Contracts\Auth\Authenticatable $user
  * @param string $token
  */
 public function updateRememberToken(Authenticatable $user, $token)
 {
     $this->user->updateRememberToken($user->getAuthIdentifier(), $token);
 }
开发者ID:illuminate3,项目名称:Saborunayo,代码行数:10,代码来源:GitHubUserProvider.php

示例9: updateRememberToken

 /**
  * Update the "remember me" token for the given user in storage.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable $user
  * @param  string $token
  * @return void
  */
 public function updateRememberToken(Authenticatable $user, $token)
 {
     $id = $user->getAuthIdentifier();
     if ($this->idShouldBeDecorated()) {
         $id = $this->makeObjectId($user->getAuthIdentifier());
     }
     $this->getCollection()->findAndModify([$this->getIdentificationField() => $id], ['$set' => [$this->getRememberTokenField() => $token]]);
 }
开发者ID:reshadman,项目名称:laravel-mongo-auth,代码行数:15,代码来源:MongoDbUserProvider.php

示例10: updateRememberToken

 /**
  * Update the "remember me" token for the given user in storage.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @param  string  $token
  * @return void
  */
 public function updateRememberToken(UserContract $user, $token)
 {
     $this->query->filterById($user->getAuthIdentifier())->update(['RememberToken' => $token]);
 }
开发者ID:scif,项目名称:propel-laravel,代码行数:11,代码来源:PropelUserProvider.php

示例11: join

 /**
  * @param Authenticatable $user
  * @return Volunteer
  */
 public function join(Authenticatable $user)
 {
     $uid = $user->getAuthIdentifier();
     return Volunteer::updateOrCreate(['user_id' => $uid, 'pending' => true, 'accepted' => false]);
 }
开发者ID:gpul-org,项目名称:labs-registrar,代码行数:9,代码来源:VolunteerRepository.php

示例12: updateRememberToken

 /**
  * Update the "remember me" token for the given user in storage.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @param  string  $token
  * @return void
  */
 public function updateRememberToken(UserContract $user, $token)
 {
     $this->conn->table($this->table)->where('id', $user->getAuthIdentifier())->update(['remember_token' => $token]);
 }
开发者ID:manhvu1212,项目名称:videoplatform,代码行数:11,代码来源:DatabaseUserProvider.php

示例13: query

 /**
  * Create the query for the sentiment, modal and user
  *
  * @param string $sentiment
  * @param \Mintbridge\EloquentSentiment\SentimentableInterface $model
  * @param \Illuminate\Contracts\Auth\Authenticatable $user
  */
 private function query($sentiment, SentimentableInterface $model, Authenticatable $user)
 {
     $query = Sentiment::where(Sentiment::ATTR_SENTIMENTABLE_ID, '=', $model->getSentimentableId())->where(Sentiment::ATTR_SENTIMENTABLE_TYPE, '=', $model->getSentimentableType())->where(Sentiment::ATTR_SENTIMENT, '=', $sentiment)->where(Sentiment::ATTR_USER_ID, '=', $user->getAuthIdentifier());
     return $query;
 }
开发者ID:mintbridge,项目名称:eloquent-sentiment,代码行数:12,代码来源:SentimentManager.php

示例14: refreshToken

 /**
  * Create a new token from the user identifier
  * 
  * @param Authenticatable $user
  * @param Token
  */
 public function refreshToken(Authenticatable $user)
 {
     $claims = ['name' => $user->name, 'email' => $user->email, 'locale' => config('app.locale')];
     return $this->repository->encode($user->getAuthIdentifier(), $claims);
 }
开发者ID:absolux,项目名称:Collabor8-php-api,代码行数:11,代码来源:UserProvider.php

示例15: createTokenForUser

 /**
  * @param  Authenticatable  $user
  * @return Token
  */
 public function createTokenForUser(Authenticatable $user)
 {
     $builder = new Builder();
     $id = $user->getAuthIdentifier();
     $builder->setSubject($id);
     if ($user instanceof ProvidesCredentials) {
         $builder = $this->applyClaims($user->getCredentials(), true, $builder);
     }
     $builder->setExpiration($this->getExpirationTimestamp());
     $builder->setId(Str::random());
     return $this->signer->sign($builder)->getToken();
 }
开发者ID:framgia,项目名称:laravel-jwt,代码行数:16,代码来源:Guard.php


注:本文中的Illuminate\Contracts\Auth\Authenticatable::getAuthIdentifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。