This repository was archived by the owner on Dec 14, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +86
-0
lines changed Expand file tree Collapse file tree 5 files changed +86
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Stormpath \Resource ;
4+
5+ /*
6+ * Copyright 2013 Stormpath, Inc.
7+ *
8+ * Licensed under the Apache License, Version 2.0 (the "License");
9+ * you may not use this file except in compliance with the License.
10+ * You may obtain a copy of the License at
11+ *
12+ * http://www.apache.org/licenses/LICENSE-2.0
13+ *
14+ * Unless required by applicable law or agreed to in writing, software
15+ * distributed under the License is distributed on an "AS IS" BASIS,
16+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+ * See the License for the specific language governing permissions and
18+ * limitations under the License.
19+ */
20+
21+ use Stormpath \Stormpath ;
22+
23+ class AccessTokenList extends AbstractCollectionResource
24+ {
25+ function getItemClassName ()
26+ {
27+ return Stormpath::ACCESS_TOKEN ;
28+ }
29+
30+ }
Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ class Account extends InstanceResource implements Deletable
3939 const FULL_NAME = "fullName " ;
4040 const TENANT = "tenant " ;
4141 const PROVIDER_DATA = "providerData " ;
42+ const ACCESS_TOKENS = "accessTokens " ;
43+ const REFRESH_TOKENS = "refreshTokens " ;
4244
4345 const PATH = "accounts " ;
4446
@@ -156,6 +158,16 @@ public function getDirectory(array $options = array())
156158 return $ this ->getResourceProperty (self ::DIRECTORY , Stormpath::DIRECTORY , $ options );
157159 }
158160
161+ public function getAccessTokens (array $ options = array ())
162+ {
163+ return $ this ->getResourceProperty (self ::ACCESS_TOKENS , Stormpath::ACCESS_TOKEN_LIST , $ options );
164+ }
165+
166+ public function getRefreshTokens (array $ options = array ())
167+ {
168+ return $ this ->getResourceProperty (self ::REFRESH_TOKENS , Stormpath::REFRESH_TOKEN_LIST , $ options );
169+ }
170+
159171 public function getEmailVerificationToken (array $ options = array ())
160172 {
161173 return $ this ->getResourceProperty (self ::EMAIL_VERIFICATION_TOKEN , Stormpath::EMAIL_VERIFICATION_TOKEN , $ options );
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Stormpath \Resource ;
4+
5+ /*
6+ * Copyright 2013 Stormpath, Inc.
7+ *
8+ * Licensed under the Apache License, Version 2.0 (the "License");
9+ * you may not use this file except in compliance with the License.
10+ * You may obtain a copy of the License at
11+ *
12+ * http://www.apache.org/licenses/LICENSE-2.0
13+ *
14+ * Unless required by applicable law or agreed to in writing, software
15+ * distributed under the License is distributed on an "AS IS" BASIS,
16+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+ * See the License for the specific language governing permissions and
18+ * limitations under the License.
19+ */
20+
21+ use Stormpath \Stormpath ;
22+
23+ class RefreshTokenList extends AbstractCollectionResource
24+ {
25+ function getItemClassName ()
26+ {
27+ return Stormpath::REFRESH_TOKEN ;
28+ }
29+
30+ }
Original file line number Diff line number Diff line change 2121class Stormpath
2222{
2323 const ACCESS_TOKEN = 'AccessToken ' ;
24+ const ACCESS_TOKEN_LIST = 'AccessTokenList ' ;
2425 const ACCOUNT = 'Account ' ;
2526 const ACCOUNT_CREATION_POLICY = "AccountCreationPolicy " ;
2627 const ACCOUNT_LIST = 'AccountList ' ;
@@ -59,6 +60,7 @@ class Stormpath
5960 const PROVIDER_ACCOUNT_RESULT = 'ProviderAccountResult ' ;
6061 const PROVIDER_DATA = 'ProviderData ' ;
6162 const REFRESH_TOKEN = 'RefreshToken ' ;
63+ const REFRESH_TOKEN_LIST = 'RefreshTokenList ' ;
6264 const TENANT = 'Tenant ' ;
6365 const VERIFICATION_EMAIL = 'VerificationEmail ' ;
6466
Original file line number Diff line number Diff line change @@ -363,6 +363,18 @@ public function testAddGroupNonExistent()
363363 self ::$ account ->addGroup (\Stormpath \Resource \Group::instantiate ());
364364 }
365365
366+ public function testItCanGetAccessTokensOffAccount ()
367+ {
368+ $ tokens = self ::$ account ->accessTokens ;
369+ $ this ->assertInstanceOf ('Stormpath\Resource\AccessTokenList ' , $ tokens );
370+ }
371+
372+ public function testItCanGetRefreshTokensOffAccount ()
373+ {
374+ $ tokens = self ::$ account ->refreshTokens ;
375+ $ this ->assertInstanceOf ('Stormpath\Resource\RefreshTokenList ' , $ tokens );
376+ }
377+
366378
367379
368380 public function testAddingCustomData ()
You can’t perform that action at this time.
0 commit comments