Tabnine Logo
UserSession.getSessionId
Code IndexAdd Tabnine to your IDE (free)

How to use
getSessionId
method
in
com.oberasoftware.jasdb.api.security.UserSession

Best Java code snippets using com.oberasoftware.jasdb.api.security.UserSession.getSessionId (Showing top 5 results out of 315)

origin: oberasoftware/jasdb

  private void validateSession() throws JasDBStorageException {
    if(session == null || !sessionManager.sessionValid(session.getSessionId())) {
      throw new JasDBSecurityException("Unable to change security principals, not logged in or session expired");
    }
  }
}
origin: oberasoftware/jasdb

@RequestMapping(method = RequestMethod.POST, value = "/token", produces = "application/json", consumes = "application/json")
public @ResponseBody
ResponseEntity<String> getToken(HttpServletRequest request) {
  if(request.isSecure()) {
    try {
      String clientId = request.getParameter("client_id");
      String clientSecret = request.getParameter("client_secret");
      LOG.debug("Client: {} host: {}", clientId, request.getRemoteHost());
      UserSession session = sessionManager.startSession(new BasicCredentials(clientId, request.getRemoteHost(), clientSecret));
      LOG.debug("Loaded session: {}", session);
      String responseMessage = String.format(GRANT_VALID, session.getAccessToken(), session.getSessionId(), "jasdb", 3600);
      return new ResponseEntity<>(responseMessage, HttpStatus.OK);
    } catch(JasDBSecurityException e) {
      return getErrorResponse("Invalid credentials");
    } catch(JasDBStorageException e) {
      return getErrorResponse("Unknown error");
    }
  } else {
    return getErrorResponse("Insecure connection");
  }
}
origin: oberasoftware/jasdb

if(context.getUserSession() != null) {
  urlConnection.setRequestProperty("oauth_token", context.getUserSession().getAccessToken());
  urlConnection.setRequestProperty("sessionid", context.getUserSession().getSessionId());
origin: oberasoftware/jasdb

public SecureUserSession(UserSession userSession) {
  this.sessionId = userSession.getSessionId();
  this.user = userSession.getUser();
  this.encryptedContentKey = userSession.getEncryptedContentKey();
  try {
    CryptoEngine cryptoEngine = CryptoFactory.getEngine();
    accessTokenHash = cryptoEngine.hash(sessionId, userSession.getAccessToken());
  } catch(JasDBSecurityException e) {
    throw new RuntimeJasDBException("Unable to hash token", e);
  }
}
origin: oberasoftware/jasdb

@Override
protected void authenticate(Credentials credentials) throws JasDBStorageException {
  if(credentials != null) {
    TokenConnector tokenConnector = RemoteConnectorFactory.createConnector(getNodeInformation(), TokenConnector.class);
    UserSession session = tokenConnector.loadSession(credentials.getUsername(), credentials.getPassword());
    if(StringUtils.stringNotEmpty(session.getAccessToken()) && StringUtils.stringNotEmpty(session.getSessionId())) {
      context = new RemotingContext(true);
      context.setUserSession(session);
      LOG.debug("Token: {} session: {}", session.getAccessToken(), session.getSessionId());
    } else {
      throw new JasDBSecurityException("Unable to obtain access token to service");
    }
  } else {
    context = new RemotingContext(true);
  }
}
com.oberasoftware.jasdb.api.securityUserSessiongetSessionId

Popular methods of UserSession

  • getAccessToken
  • getEncryptedContentKey
  • getUser

Popular in Java

  • Reading from database using SQL prepared statement
  • putExtra (Intent)
  • getContentResolver (Context)
  • getApplicationContext (Context)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now