This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getCurrentUser(waterwheelInstance, username) { | |
return waterwheelInstance.jsonapi.get('user/user', { | |
filter: { name: { value: username } } } ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User.getCurrentUser(waterwheelInstance, username).then(result.... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
base: 'http://drupal', | |
oauth: { | |
grant_type: 'password', | |
client_id: '<client_id>', | |
client_secret: '<client_secret>', | |
scope: 'student teacher authenticated', | |
username: '<drupal_username>', | |
password: '<drupal_password>' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
req.session.tokenInformation = _.cloneDeep(waterwheel.oauth.tokenInformation); | |
req.session.tokenExpireTime = waterwheel.oauth.tokenExpireTime; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (req.session.tokenInformation && req.session.tokenExpireTime) { | |
const config = _.cloneDeep(sails.config.waterwheel); | |
config.oauth = _.cloneDeep(req.session.tokenInformation); | |
config.oauth.tokenExpireTime = req.session.tokenExpireTime; | |
req.waterwheel = new Waterwheel(config); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (req.waterwheel) { | |
req.session.tokenInformation = _.cloneDeep(req.waterwheel.oauth.tokenInformation); | |
req.session.tokenExpireTime = req.waterwheel.oauth.tokenExpireTime; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach ($scopes as $scope) { | |
if (in_array($scope->getIdentifier(), $oldRefreshToken['scopes']) === false) { | |
throw OAuthServerException::invalidScope($scope->getIdentifier()); | |
} | |
} | |
... | |
$accessToken = $this->issueAccessToken($accessTokenTTL, $client, $oldRefreshToken['user_id'], $scopes); | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$newScopes = array(); | |
$newScopesIdentifiers = array(); | |
foreach ($scopes as $scope) { | |
if (in_array($scope->getIdentifier(), $oldRefreshToken['scopes'])) { | |
array_push($newScopes, $scope); | |
array_push($newScopesIdentifiers, $scope->getIdentifier()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.nio.ByteBuffer; | |
import android.graphics.Bitmap; | |
import android.graphics.BitmapFactory; | |
public class AndroidBmpUtil { | |
private static final int BMP_WIDTH_OF_TIMES = 4; | |
private static final int BYTE_PER_PIXEL = 3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void handleMessage(Message msg) { | |
int status = msg.getData().getInt("status"); | |
switch (status) { | |
case Status.INITIALISED: | |
case Status.SCANNER_POWERED_ON: | |
case Status.READY_TO_SCAN: | |
case Status.FINGER_DETECTED: | |
case Status.RECEIVING_IMAGE: | |
case Status.FINGER_LIFTED: | |
case Status.SCANNER_POWERED_OFF: |