Class DatabaseLoginRealm

  • All Implemented Interfaces:
    javax.management.MBeanRegistration, org.apache.catalina.Contained, org.apache.catalina.JmxEnabled, org.apache.catalina.Lifecycle, org.apache.catalina.Realm

    public abstract class DatabaseLoginRealm
    extends org.apache.catalina.realm.RealmBase
    There are two ways to set the jdbcurl 1. In the server.xml as property <Realm className="io.rtdi.appcontainer.snowflakerealm.SnowflakeRealm" JDBCURL="jdbc:snowflake://<account_name>.snowflakecomputing.com/?<connection_params>"/> 2. As environment variable called JDBCURL
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.catalina.realm.RealmBase

        org.apache.catalina.realm.RealmBase.AllRolesMode
      • Nested classes/interfaces inherited from interface org.apache.catalina.Lifecycle

        org.apache.catalina.Lifecycle.SingleUse
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.apache.juli.logging.Log log  
      • Fields inherited from class org.apache.catalina.realm.RealmBase

        allRolesMode, container, containerLog, realmPath, sm, stripRealmForGss, support, validate, x509UsernameRetriever, x509UsernameRetrieverClassName
      • Fields inherited from interface org.apache.catalina.Lifecycle

        AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
    • Method Summary

      Modifier and Type Method Description
      java.security.Principal authenticate​(java.lang.String username, java.lang.String credentials)  
      protected abstract java.security.Principal createNewPrincipal​(java.lang.String username, java.lang.String credentials, java.lang.String jdbcurl)  
      java.lang.String getJDBCURL()  
      protected java.lang.String getPassword​(java.lang.String username)
      Actually returns null for security reasons
      protected java.security.Principal getPrincipal​(java.lang.String username)
      Get the SnowflakePrincipal associated with the specified user
      void setJDBCURL​(java.lang.String jdbcurl)  
      • Methods inherited from class org.apache.catalina.realm.RealmBase

        addPropertyChangeListener, authenticate, authenticate, authenticate, authenticate, authenticate, backgroundProcess, findSecurityConstraints, getAllRolesMode, getContainer, getCredentialHandler, getDigest, getDomainInternal, getObjectNameKeyProperties, getPrincipal, getPrincipal, getRealmPath, getRealmSuffix, getServer, getTransportGuaranteeRedirectStatus, getValidate, getX509UsernameRetrieverClassName, hasMessageDigest, hasResourcePermission, hasRole, hasRoleInternal, hasUserDataPermission, initInternal, isStripRealmForGss, main, removePropertyChangeListener, setAllRolesMode, setContainer, setCredentialHandler, setRealmPath, setStripRealmForGss, setTransportGuaranteeRedirectStatus, setValidate, setX509UsernameRetrieverClassName, startInternal, stopInternal, toString
      • Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase

        destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregister
      • Methods inherited from class org.apache.catalina.util.LifecycleBase

        addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.apache.catalina.Realm

        isAvailable
    • Field Detail

      • log

        protected final org.apache.juli.logging.Log log
    • Constructor Detail

      • DatabaseLoginRealm

        public DatabaseLoginRealm()
    • Method Detail

      • authenticate

        public java.security.Principal authenticate​(java.lang.String username,
                                                    java.lang.String credentials)
        Specified by:
        authenticate in interface org.apache.catalina.Realm
        Overrides:
        authenticate in class org.apache.catalina.realm.RealmBase
      • createNewPrincipal

        protected abstract java.security.Principal createNewPrincipal​(java.lang.String username,
                                                                      java.lang.String credentials,
                                                                      java.lang.String jdbcurl)
                                                               throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getPassword

        protected java.lang.String getPassword​(java.lang.String username)
        Actually returns null for security reasons
        Specified by:
        getPassword in class org.apache.catalina.realm.RealmBase
      • getPrincipal

        protected java.security.Principal getPrincipal​(java.lang.String username)
        Get the SnowflakePrincipal associated with the specified user
        Specified by:
        getPrincipal in class org.apache.catalina.realm.RealmBase
        Returns:
        SnowflakePrincipal
      • getJDBCURL

        public java.lang.String getJDBCURL()
        Returns:
        JDBC URL of the used database
      • setJDBCURL

        public void setJDBCURL​(java.lang.String jdbcurl)
        Parameters:
        jdbcurl - the JDBC URL to be used