Commit 188a3084d54ea58b718a1b648266273a7b36f95b
1 parent
9a10ae9e
Exists in
master
and in
1 other branch
incluindo campo sigla no retorno da autenticação
Showing
2 changed files
with
24 additions
and
1 deletions
Show diff stats
controlador_ws.php
| @@ -32,6 +32,7 @@ class TokenValidationMiddleware{ | @@ -32,6 +32,7 @@ class TokenValidationMiddleware{ | ||
| 32 | } | 32 | } |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | + | ||
| 35 | $config = array( | 36 | $config = array( |
| 36 | 'settings' => array( | 37 | 'settings' => array( |
| 37 | 'determineRouteBeforeAppMiddleware' => true, | 38 | 'determineRouteBeforeAppMiddleware' => true, |
| @@ -41,6 +42,24 @@ $config = array( | @@ -41,6 +42,24 @@ $config = array( | ||
| 41 | 42 | ||
| 42 | $app = new \Slim\App($config); | 43 | $app = new \Slim\App($config); |
| 43 | 44 | ||
| 45 | +//Enable CORS | ||
| 46 | +// $app->options('/{routes:.+}', function ($request, $response, $args) { | ||
| 47 | +// return $response; | ||
| 48 | +// }); | ||
| 49 | + | ||
| 50 | +// $app->add(function ($req, $res, $next) { | ||
| 51 | +// $response = $next($req, $res); | ||
| 52 | + | ||
| 53 | +// //cabeçalhos encontrados na implementação do Mobile | ||
| 54 | +// $strAllowHeaders = 'X-Requested-With, Content-Type, Accept, Origin, Authorization, Access-Control-Max-Age, If-Modified-Since' . | ||
| 55 | +// 'token, User-Agent, Cookie, Content-Disposition, Content-Length, Transfer-Encoding, Accept-Encoding'; | ||
| 56 | + | ||
| 57 | +// return $response->withHeader('Access-Control-Allow-Origin', 'http://localhost:8100') //Especifico para o IONIC | ||
| 58 | +// ->withHeader('Access-Control-Allow-Headers', $strAllowHeaders) | ||
| 59 | +// ->withHeader('Access-Control-Allow-Credentials', 'true') | ||
| 60 | +// ->withHeader('Access-Control-Allow-Methods', 'GET, PUT, POST, DELETE, OPTIONS, HEAD'); | ||
| 61 | +// }); | ||
| 62 | + | ||
| 44 | /** | 63 | /** |
| 45 | * Grupo para a versao v1 de servicos REST | 64 | * Grupo para a versao v1 de servicos REST |
| 46 | */ | 65 | */ |
rn/MdWsSeiUsuarioRN.php
| @@ -180,13 +180,17 @@ class MdWsSeiUsuarioRN extends InfraRN { | @@ -180,13 +180,17 @@ class MdWsSeiUsuarioRN extends InfraRN { | ||
| 180 | $this->encriptaSenha($usuarioDTO->getStrSenha()), | 180 | $this->encriptaSenha($usuarioDTO->getStrSenha()), |
| 181 | ConfiguracaoSEI::getInstance()->getValor('SessaoSEI', 'SiglaSistema'), | 181 | ConfiguracaoSEI::getInstance()->getValor('SessaoSEI', 'SiglaSistema'), |
| 182 | $siglaOrgao | 182 | $siglaOrgao |
| 183 | - ); | 183 | + ); |
| 184 | 184 | ||
| 185 | if(!$ret){ | 185 | if(!$ret){ |
| 186 | throw new InfraException('Usuário ou senha inválido!'); | 186 | throw new InfraException('Usuário ou senha inválido!'); |
| 187 | } | 187 | } |
| 188 | $this->setaVariaveisAutenticacao(get_object_vars($ret)); | 188 | $this->setaVariaveisAutenticacao(get_object_vars($ret)); |
| 189 | + | ||
| 190 | + //dados usuário | ||
| 189 | $ret->id_unidade_atual = SessaoSEI::getInstance()->getNumIdUnidadeAtual(); | 191 | $ret->id_unidade_atual = SessaoSEI::getInstance()->getNumIdUnidadeAtual(); |
| 192 | + $ret->sigla = $usuarioDTO->getStrSigla(); | ||
| 193 | + | ||
| 190 | $token = $this->tokenEncode($usuarioDTO->getStrSigla(), $usuarioDTO->getStrSenha()); | 194 | $token = $this->tokenEncode($usuarioDTO->getStrSigla(), $usuarioDTO->getStrSenha()); |
| 191 | 195 | ||
| 192 | $arrUnidades = array(); | 196 | $arrUnidades = array(); |